Vue routing

Salifyanji Taala
2 min readMay 22, 2020

In this post am going to share two ways of routing in vuejs. After installing your vue-router, you need to import it in your main.js file for you to use it. Below is a code snippet that shows you how to import your vue-router in your main.js file of the root folder.

Once vue-router is imported, you are ready to use it in your application. You can either use it in this way below by importing the component in the routes array.

Or the other way is importing the component before routes array like in the snippet below.

In your App.vue file you can link your route by using html anchor tag like below.

Or use the router tag like below

So there you have it, how to route using vue-routes. Hope this post works for you. Happy codding.

--

--

Salifyanji Taala

Philomath. Everything posted is based on my Experience and learning from others.