You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
834 B
42 lines
834 B
6 years ago
|
<template>
|
||
|
<div id="app">
|
||
|
<router-view v-if="isRouterAlive" />
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
provide() {
|
||
|
return {
|
||
|
reload: this.reload
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
isRouterAlive: true
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
$route: 'routeChange'
|
||
|
},
|
||
|
methods: {
|
||
|
reload() {
|
||
|
this.isRouterAlive = false
|
||
|
this.$nextTick(() => (this.isRouterAlive = true))
|
||
|
},
|
||
|
routeChange(newVal, oldVal) {
|
||
|
if (newVal.name == oldVal.name) {
|
||
|
this.reload()
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
metaInfo: {
|
||
|
titleTemplate: title => {
|
||
|
return title
|
||
|
? `${title} - ${process.env.VUE_APP_TITLE}`
|
||
|
: process.env.VUE_APP_TITLE
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|