Vue 实现刷新
Vue 实现刷新
app.vue
<router-view v-if="isRouterAlive"></router-view>
app.vue
export default {
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'],
data() {
return {}
}
}

浙公网安备 33010602011771号