在 app.vue 组件里面的编写
<template>
<div id="app">
<!-- 路由占位符 -->
<router-view v-if="isRouterAlive"></router-view>
</div>
</template>
<script>
export default {
provide () {
return {
reload: this.reload
}
},
data () {
return {
isRouterAlive: true
}
},
methods: {
reload () {
this.isRouterAlive = false
this.$nextTick(function () {
this.isRouterAlive = true
})
}
}
}
</script>
<style lang="less" scoped>
</style>
在需要用到的组件里面引用
export default {
inject: ['reload'],
// 监听对话框的确定按钮
editCategoryDialogConfirm () {
let _this = this
_this.reload()
})
}
}
网友评论