Skip to content

Commit 36060d5

Browse files
committed
perf[Exapme]: set page title according to article id
1 parent a0b2014 commit 36060d5

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
@@ -183,12 +183,16 @@ export default {
183183
fetchData(id) {
184184
fetchArticle(id).then(response => {
185185
this.postForm = response.data
186-
// Just for test
186+
187+
// just for test
187188
this.postForm.title += ` Article Id:${this.postForm.id}`
188189
this.postForm.content_short += ` Article Id:${this.postForm.id}`
189190
190-
// Set tagsview title
191+
// set tagsview title
191192
this.setTagsViewTitle()
193+
194+
// set page title
195+
this.setPageTitle()
192196
}).catch(err => {
193197
console.log(err)
194198
})
@@ -198,6 +202,10 @@ export default {
198202
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.postForm.id}` })
199203
this.$store.dispatch('tagsView/updateVisitedView', route)
200204
},
205+
setPageTitle() {
206+
const title = 'Edit Article'
207+
document.title = `${title} - ${this.postForm.id}`
208+
},
201209
submitForm() {
202210
console.log(this.postForm)
203211
this.$refs.postForm.validate(valid => {

0 commit comments

Comments
 (0)