vue2.7+vue-router3.6.5 watch router or router.currentRoute.path question #9512
Answered
by
Alfred-Skyblue
Miofly
asked this question in
Help/Questions
-
in App.vue route change watch not trgger
why oldValue === val
home.vue
why onDeactivated after onBeforeRouteLeave repo link: https://github.com/Miofly/demo-issue-template/tree/vue2-template |
Beta Was this translation helpful? Give feedback.
Answered by
Alfred-Skyblue
Oct 31, 2023
Replies: 1 comment 1 reply
-
You can use the following method to monitor routing changes in vue2.7: const vm = getCurrentInstance()
vm.proxy.$watch(
() => vm.proxy.$route,
route => {
console.log(route)
}
) For the behavior of oldVal === val, see: #9191 (comment) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Miofly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the following method to monitor routing changes in vue2.7:
For the behavior of oldVal === val, see: #9191 (comment)