vue.js - How to stop router from a component? -
there component
 takes action , person should not leave without having saving
 there method beforedestroy()
 works fine, not understand how stop transition.
 rather, link changes, component has not yet deleted.  
you should using router's navigation guards (https://router.vuejs.org/en/advanced/navigation-guards.html) , register guard on
router.beforeeach((to, from, next) => {   // ... })) method.   then need call next(false) cancel navigation after checking component dirty.
Comments
Post a Comment