vue 异步刷新页面,

入口文件vue.app中
<div id="app">
<router-view v-if="isRouterAlive" />
</div>
</template>

 

<script>
export default {
name: 'App',
provide (){
return {
reload:this.reload
}
},
data(){
return {
isRouterAlive:true
}
},
methods:{
reload (){
this.isRouterAlive = false
this.$nextTick(function(){
this.isRouterAlive = true
})
}
}
 
 
子组件中
事件执行 : 
this.reload()
 
export default {
 inject:['reload']
}
posted @ 2019-02-20 16:17  誰舆徴夆  阅读(1218)  评论(0编辑  收藏  举报