Sometimes we would like to have same route with different name, such guide to FAQ, help, how-to etc. Vue allow us to use the redirect feature for this purpose.
Redirect can be used in our index route file in the following format
import Vue from "vue";
......
Vue.use(VueRouter);
const routes = [
{
path: "/",
name: "Line",
component: LineChart,
},
{
// The redirect can also be targeting a named route:
path: "/help",
redirect: { name: 'About' }
}
];
const router = new VueRouter({
routes
});
export default router;
In the above router configuration we redirect /help router to the named route /About. For multiple route we have to reply on alias.
Following vue-route post may interest you
- Create doughnut chart component in Vuejs - How to Create a doughnut chart in Vue using vue-chartjs module
- Create line chart component in Vue - How to Create a LineChart in Vue using vue-chartjs module
- redirecting multiple routes in Vuejs - How to redirect multiple routes in vuejs
- Redirect a route in Vue router - How to redirect an route to a named routed in vuejs
- How to add router in Vuejs project - How to configure vue router for new and existing projects