Skip to content

Commit 4f9efc8

Browse files
committed
perf[Exapme]: set page title according to article id
1 parent 71ece14 commit 4f9efc8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/views/example/components/ArticleDetail.vue

+10-2
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,16 @@ export default {
185185
fetchData(id) {
186186
fetchArticle(id).then(response => {
187187
this.postForm = response.data
188-
// Just for test
188+
189+
// just for test
189190
this.postForm.title += ` Article Id:${this.postForm.id}`
190191
this.postForm.content_short += ` Article Id:${this.postForm.id}`
191192
192-
// Set tagsview title
193+
// set tagsview title
193194
this.setTagsViewTitle()
195+
196+
// set page title
197+
this.setPageTitle()
194198
}).catch(err => {
195199
console.log(err)
196200
})
@@ -200,6 +204,10 @@ export default {
200204
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.postForm.id}` })
201205
this.$store.dispatch('tagsView/updateVisitedView', route)
202206
},
207+
setPageTitle() {
208+
const title = 'Edit Article'
209+
document.title = `${title} - ${this.postForm.id}`
210+
},
203211
submitForm() {
204212
console.log(this.postForm)
205213
this.$refs.postForm.validate(valid => {

0 commit comments

Comments
 (0)