Router is enabling us to use vue app as different URL enabled , such as one of Home, About etc. It is not a new feature, it exists in react, angular etc.
Virtually router turn single page vuejs app into multi page app, in reality these pages are components (known for developers, not the end user). When the user click on the link Vuejs simply switching between these components.
Vue Router
By adding a Vue router to our app Vue will create additional folder structure , a router, view and configuration files.
View and Router
Views are page components ( url such as /about), which can be consisting of other components to. You can create additional pages as you wish and should configure on the router file.
New Vue project with router
In the CLI command we can specify whether want to use router on not, that is it.
For existing non router project
For existing non router projects it is possible to add router, but be careful that the app.vue file will be replaced by the vue CLI. So copy the content to clipboard or another file and move it back when the process is completed.
Issue the following command to add router using the vue CLI.
vue add router // say no to history
That is all you know about router,
The following vue post posts may help you
- How reactivity works in Vuejs - How to use reactive feature in Vuejs
- Create a desktop version of Quasar-Vue app using Electron - How to build desktop version of Quasar Vue app using Electron
- Create PolarArea chart component in Vue - How to Create a PolarArea Chart component in Vue using vue-chartjs module
- Create Radar component in Vue - How to Create a Radar Chart component in Vue using vue-chartjs module
- Create Horizontal Bar chart component in Vue - How to Create a HoruzotalBar Chart component in Vue using vue-chartjs module
- Create Scatter chart component in Vue - How to Create a scatter Chart component in Vue using vue-chartjs module
- Create Bubble chart component in Vue - How to Create a bubble Chart component in Vue using vue-chartjs module
- Quasar UI framework for Vue - About Quasar Vuejs UI framework and How to create and run Vuejs app with Quasar CLI tool
- Component with same name in Vuejs - How to dealing with component has same name in Vuejs
- Create Pie chart component in Vue - How to Create a Pie Chart component in Vue using vue-chartjs module