fix[TagsView]: fixed update tags title demo bug (#1223)
This commit is contained in:
parent
df23405bde
commit
41a5615ee5
|
@ -143,7 +143,8 @@ export default {
|
||||||
title: [{ validator: validateRequire }],
|
title: [{ validator: validateRequire }],
|
||||||
content: [{ validator: validateRequire }],
|
content: [{ validator: validateRequire }],
|
||||||
source_uri: [{ validator: validateSourceUri, trigger: 'blur' }]
|
source_uri: [{ validator: validateSourceUri, trigger: 'blur' }]
|
||||||
}
|
},
|
||||||
|
tempRoute: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -161,6 +162,11 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.postForm = Object.assign({}, defaultForm)
|
this.postForm = Object.assign({}, defaultForm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Why need to make a copy of this.$route here?
|
||||||
|
// Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page
|
||||||
|
// https://github.com/PanJiaChen/vue-element-admin/issues/1221
|
||||||
|
this.tempRoute = Object.assign({}, this.$route)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchData(id) {
|
fetchData(id) {
|
||||||
|
@ -178,7 +184,7 @@ export default {
|
||||||
},
|
},
|
||||||
setTagsViewTitle() {
|
setTagsViewTitle() {
|
||||||
const title = this.lang === 'zh' ? '编辑文章' : 'Edit Article'
|
const title = this.lang === 'zh' ? '编辑文章' : 'Edit Article'
|
||||||
const route = Object.assign({}, this.$route, { title: `${title}-${this.postForm.id}` })
|
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.postForm.id}` })
|
||||||
this.$store.dispatch('updateVisitedView', route)
|
this.$store.dispatch('updateVisitedView', route)
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
|
Loading…
Reference in New Issue