File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
// translate router.meta.title, be used in breadcrumb sidebar tagsview
2
2
export function generateTitle ( title ) {
3
3
const hasKey = this . $te ( 'route.' + title )
4
- const translatedTitle = this . $t ( 'route.' + title ) // $t :this method from vue-i18n, inject in @/lang/index.js
5
4
6
5
if ( hasKey ) {
6
+ // $t :this method from vue-i18n, inject in @/lang/index.js
7
+ const translatedTitle = this . $t ( 'route.' + title )
8
+
7
9
return translatedTitle
8
10
}
9
11
return title
Original file line number Diff line number Diff line change @@ -149,6 +149,9 @@ export default {
149
149
computed: {
150
150
contentShortLength () {
151
151
return this .postForm .content_short .length
152
+ },
153
+ lang () {
154
+ return this .$store .getters .language
152
155
}
153
156
},
154
157
created () {
@@ -166,10 +169,18 @@ export default {
166
169
// Just for test
167
170
this .postForm .title += ` Article Id:${ this .postForm .id } `
168
171
this .postForm .content_short += ` Article Id:${ this .postForm .id } `
172
+
173
+ // Set tagsview title
174
+ this .setTagsViewTitle ()
169
175
}).catch (err => {
170
176
console .log (err)
171
177
})
172
178
},
179
+ setTagsViewTitle () {
180
+ const title = this .lang === ' zh' ? ' 编辑文章' : ' Edit Article'
181
+ const route = Object .assign ({}, this .$route , { title: ` ${ title} -${ this .postForm .id } ` })
182
+ this .$store .dispatch (' updateVisitedView' , route)
183
+ },
173
184
submitForm () {
174
185
this .postForm .display_time = parseInt (this .display_time / 1000 )
175
186
console .log (this .postForm )
You can’t perform that action at this time.
0 commit comments