1👍
You should be using the router’s Navigation Guards (https://router.vuejs.org/en/advanced/navigation-guards.html) and register your guard on the
router.beforeEach((to, from, next) => {
// ...
})) method.
Then you just need to call next(false)
to cancel the navigation after checking that your component is dirty.
- [Vuejs]-Applying css to the table row dynamically created with Vue.js
- [Vuejs]-Can't add <script> tag to Vue component files ( *.vue )
Source:stackexchange.com