We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37069da commit 7a6c2eeCopy full SHA for 7a6c2ee
src/App.vue
@@ -73,7 +73,7 @@
73
</template>
74
75
<script>
76
-import { reactive } from 'vue'
+import { onUnmounted, reactive } from 'vue'
77
import Header from '@/components/Header.vue'
78
import Footer from '@/components/Footer.vue'
79
import { useRouter } from 'vue-router'
@@ -95,7 +95,7 @@ export default {
95
number: 1
96
}
97
})
98
- router.beforeEach((to, from, next) => {
+ const unwatch = router.beforeEach((to, from, next) => {
99
if (to.path == '/login') {
100
// 如果路径是 /login 则正常执行
101
next()
@@ -113,6 +113,11 @@ export default {
113
state.currentPath = to.path
114
document.title = pathMap[to.name]
115
116
+
117
+ onUnmounted(() => {
118
+ unwatch()
119
+ })
120
121
return {
122
state
123
0 commit comments