Skip to content

Commit

Permalink
fix: strip html tag in document.title
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Dec 16, 2018
1 parent 922ccb8 commit a2c6c4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ export default {
'$route.hash'() {
this.jumpToHash()
},
'$store.state.page.title'(title) {
pageTitle(newValue) {
const {path} = this.$route
const {config, homePaths} = this.$store.getters
if (homePaths.indexOf(path) > -1) {
document.title = config.title
} else {
const div = document.createElement('div')
div.innerHTML = newValue
const title = div.textContent
document.title = `${title} - ${config.title}`
}
}
Expand Down

0 comments on commit a2c6c4d

Please sign in to comment.