File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1010</template >
1111
1212<script >
13+ import { generateTitle } from ' @/utils/i18n'
14+
1315export default {
1416 created () {
1517 this .getBreadcrumb ()
@@ -25,16 +27,14 @@ export default {
2527 }
2628 },
2729 methods: {
30+ generateTitle,
2831 getBreadcrumb () {
2932 let matched = this .$route .matched .filter (item => item .name )
3033 const first = matched[0 ]
3134 if (first && first .name !== ' dashboard' ) {
3235 matched = [{ path: ' /dashboard' , meta: { title: ' dashboard' }}].concat (matched)
3336 }
3437 this .levelList = matched
35- },
36- generateTitle (title ) {
37- return this .$t (' route.' + title)
3838 }
3939 }
4040}
Original file line number Diff line number Diff line change 1+ export function generateTitle ( title ) {
2+ return this . $t ( 'route.' + title ) // $t :this method from vue-i18n ,inject in @/lang/index.js
3+ }
Original file line number Diff line number Diff line change 3232</template >
3333
3434<script >
35+ import { generateTitle } from ' @/utils/i18n'
36+
3537export default {
3638 name: ' SidebarItem' ,
3739 props: {
@@ -40,9 +42,7 @@ export default {
4042 }
4143 },
4244 methods: {
43- generateTitle (title ) {
44- return this .$t (' route.' + title)
45- }
45+ generateTitle
4646 }
4747}
4848 </script >
Original file line number Diff line number Diff line change 11<template >
22 <scroll-pane class =' tags-view-container' ref =' scrollPane' >
33 <router-link ref =' tag' class =" tags-view-item" :class =" isActive(tag)?'active':''" v-for =" tag in Array.from(visitedViews)" :to =" tag.path" :key =" tag.path" >
4- {{$t('route.'+ tag.title)}}
4+ {{generateTitle( tag.title)}}
55 <span class =' el-icon-close' @click =' closeViewTags(tag,$event)' ></span >
66 </router-link >
77 </scroll-pane >
88</template >
99
1010<script >
1111import ScrollPane from ' @/components/ScrollPane'
12+ import { generateTitle } from ' @/utils/i18n'
1213
1314export default {
1415 components: { ScrollPane },
@@ -21,6 +22,7 @@ export default {
2122 this .addViewTags ()
2223 },
2324 methods: {
25+ generateTitle,
2426 closeViewTags (view , $event ) {
2527 this .$store .dispatch (' delVisitedViews' , view).then ((views ) => {
2628 if (this .isActive (view)) {
@@ -61,7 +63,6 @@ export default {
6163 }
6264 })
6365 }
64-
6566 },
6667 watch: {
6768 $route () {
You can’t perform that action at this time.
0 commit comments