原文:https://blog.csdn.net/yufengaotian/article/details/81238792

App.vue

<template>
  <div id="app">
        <router-view v-if="isRouterAlive"></router-view>
  </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
       })
    }
  },
  components:{
  }
}
</script>

子页面

<script>
export default {
inject:['reload'],

methods:{
	clear(){
		this.reload()
	 }
 }
 </script>
Logo

前往低代码交流专区

更多推荐