From 4f9efc8ea459fe248a88b21b46d5705364f538b4 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 17 May 2019 10:20:42 +0800 Subject: [PATCH] perf[Exapme]: set page title according to article id --- src/views/example/components/ArticleDetail.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/example/components/ArticleDetail.vue b/src/views/example/components/ArticleDetail.vue index 4f4dfe05..59d7fce1 100644 --- a/src/views/example/components/ArticleDetail.vue +++ b/src/views/example/components/ArticleDetail.vue @@ -185,12 +185,16 @@ export default { fetchData(id) { fetchArticle(id).then(response => { this.postForm = response.data - // Just for test + + // just for test this.postForm.title += ` Article Id:${this.postForm.id}` this.postForm.content_short += ` Article Id:${this.postForm.id}` - // Set tagsview title + // set tagsview title this.setTagsViewTitle() + + // set page title + this.setPageTitle() }).catch(err => { console.log(err) }) @@ -200,6 +204,10 @@ export default { const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.postForm.id}` }) this.$store.dispatch('tagsView/updateVisitedView', route) }, + setPageTitle() { + const title = 'Edit Article' + document.title = `${title} - ${this.postForm.id}` + }, submitForm() { console.log(this.postForm) this.$refs.postForm.validate(valid => {