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.
 
 
 
 
 
 

46 lines
915 B

<template>
<div id="app">
<router-view class="router-view" v-if="isRouterAlive"/>
</div>
</template>
<script>
import {mapGetters} from 'vuex'
export default {
name: 'App',
computed: {
...mapGetters(['activeIndex','isLoading'])
},
provide() {
return{
reload: this.reload
}
},
data() {
return {
isRouterAlive: true
}
},
watch: {
$route(to, from) {
if (to.meta.menuIndex) {
this.$store.commit('app/SET_ACTIVEINDEX', to.meta.menuIndex)
} else {
this.$store.commit('app/SET_ACTIVEINDEX', to.path)
}
}
},
methods: {
//页面重新载入函数
reload() {
this.isRouterAlive = false;
this.$nextTick(function () {
this.isRouterAlive = true
})
}
},
}
</script>