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 10
10
</template >
11
11
12
12
<script >
13
+ import { generateTitle } from ' @/utils/i18n'
14
+
13
15
export default {
14
16
created () {
15
17
this .getBreadcrumb ()
@@ -25,16 +27,14 @@ export default {
25
27
}
26
28
},
27
29
methods: {
30
+ generateTitle,
28
31
getBreadcrumb () {
29
32
let matched = this .$route .matched .filter (item => item .name )
30
33
const first = matched[0 ]
31
34
if (first && first .name !== ' dashboard' ) {
32
35
matched = [{ path: ' /dashboard' , meta: { title: ' dashboard' }}].concat (matched)
33
36
}
34
37
this .levelList = matched
35
- },
36
- generateTitle (title ) {
37
- return this .$t (' route.' + title)
38
38
}
39
39
}
40
40
}
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 32
32
</template >
33
33
34
34
<script >
35
+ import { generateTitle } from ' @/utils/i18n'
36
+
35
37
export default {
36
38
name: ' SidebarItem' ,
37
39
props: {
@@ -40,9 +42,7 @@ export default {
40
42
}
41
43
},
42
44
methods: {
43
- generateTitle (title ) {
44
- return this .$t (' route.' + title)
45
- }
45
+ generateTitle
46
46
}
47
47
}
48
48
</script >
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<scroll-pane class =' tags-view-container' ref =' scrollPane' >
3
3
<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)}}
5
5
<span class =' el-icon-close' @click =' closeViewTags(tag,$event)' ></span >
6
6
</router-link >
7
7
</scroll-pane >
8
8
</template >
9
9
10
10
<script >
11
11
import ScrollPane from ' @/components/ScrollPane'
12
+ import { generateTitle } from ' @/utils/i18n'
12
13
13
14
export default {
14
15
components: { ScrollPane },
@@ -21,6 +22,7 @@ export default {
21
22
this .addViewTags ()
22
23
},
23
24
methods: {
25
+ generateTitle,
24
26
closeViewTags (view , $event ) {
25
27
this .$store .dispatch (' delVisitedViews' , view).then ((views ) => {
26
28
if (this .isActive (view)) {
@@ -61,7 +63,6 @@ export default {
61
63
}
62
64
})
63
65
}
64
-
65
66
},
66
67
watch: {
67
68
$route () {
You can’t perform that action at this time.
0 commit comments