0👍
Vue-router has fantastic way of dynamic redirects / checks:
const router = new VueRouter({
routes: [
{ path: '/a', redirect: to => {
// the function receives the target route as the argument
// return redirect path/location here.
}}
]
})
You can place route checks into this function and perform any needed validations.
Or… you can use the full power of Vue-router reg-exp and write your path in router.js like this one:
/(clothes|electronics|babies)/*
- [Vuejs]-Internet Explorer issue with remote Vue.js
- [Vuejs]-Design: Two Vue Components That Share Similar Sass
Source:stackexchange.com