Skip to content

Commit

Permalink
fix[TagsView]: fixed update tags title demo bug (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen authored Oct 18, 2018
1 parent df23405 commit 41a5615
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/views/example/components/ArticleDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ export default {
title: [{ validator: validateRequire }],
content: [{ validator: validateRequire }],
source_uri: [{ validator: validateSourceUri, trigger: 'blur' }]
}
},
tempRoute: {}
}
},
computed: {
Expand All @@ -161,6 +162,11 @@ export default {
} else {
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: {
fetchData(id) {
Expand All @@ -178,7 +184,7 @@ export default {
},
setTagsViewTitle() {
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)
},
submitForm() {
Expand Down

0 comments on commit 41a5615

Please sign in to comment.