[Vuejs]-Choose which component to show on certain route in Vue.js

0👍

According to Codesandbox, it is possible.

However, the routes tree is built at the app startup, so if you change the variable through an action from your app, nothing should happen, the tree shouldn’t be built again.

EDIT:

Vue Router has an API that allows you to update your tree after the tree was built.

You have Router.addRoute(), and this trick that allows you to reset the tree to its initial state and conditionally add the route you want to keep.

Leave a comment