1、在app.vue中
<template>
<div id="app">
<router-view v-if="isReload"></router-view>
</div>
</template>
<style>
@import "../static/css/main.css";
</style>
<script>
export default {
name: "App",
provide() {
return {
reload: this.reload,
};
},
data() {
return {
isReload: true,
};
},
methods: {
reload() {
this.isReload = false;
this.$nextTick(() => {
this.isReload = true;
});
},
},
};
</script>
2、在需要刷新的页面中如下处理
<script>
export default {
inject: ["reload"],
data() {
return {
};
},
methods: {
//要刷新的地方调用这个方法
this.reload()
};
</script>
3、大功告成!!!!!