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(()=>this.isRouterAlive=true)
}
},
}
</script>
<style>
html,
body {
margin: 0;
padding: 0;
}
.el-table__body tr.current-row>td{
background-color: #BBBBBB;
}
</style>
需要使用的页面中调用如下
export default {
inject:['reload'],
data() {
}
}
this.reload()直接调用即可