一、修改APP.vuevue
<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(()=>{
this.isRouterAlive=true
})
}
}
}
</script>
複製代碼
二、須要刷新的頁面bash
export default {
inject:['reload'],
………………
複製代碼
三、直接調用this.reload()便可app