Commit 5dff25e9 by 穆启卓

provide / inject 处理vue重新路由到当前页面

parent e66965e9
<template>
<div id="app">
<router-view/>
<router-view v-if="isRouterAlive"/>
<HelloWorld></HelloWorld>
</div>
</template>
......@@ -10,6 +10,16 @@
components: {
HelloWorld
},
provide() {
return {
reload: this.reload
}
},
data() {
return {
isRouterAlive: true
}
},
mounted() {
// 是否直接打开报名页
(() => {
......@@ -54,6 +64,14 @@
false
);
})(window);
},
methods: {
reload() {
this.isRouterAlive = false;
this.$nextTick(() => {
this.isRouterAlive = true;
})
}
}
};
</script>
......
......@@ -154,6 +154,7 @@ export default {
Reborn,
ShareModal
},
inject: ['reload'],
data() {
return {
swiperOption: {
......@@ -232,6 +233,7 @@ export default {
week: this.next_period
}
});
this.reload();
} else {
this.$router.push({
name: "PartakeChallenge",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment