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

Popular posts from this blog

vb.net - How to ignore if a cell is empty nothing -

Sort a complex associative array in PHP -

recursion - Can every recursive algorithm be improved with dynamic programming? -