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

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -