
When building single-page applications many Vue developers forget about UX for browser button navigation. Then add leave-active and then give it the CSS transition properties just like this. To animate the transition of the component when it enters the view, add enter-active to the name given to the transition tag. To make an animation transition, put the “” inside the “” tag and give it a name of class. It makes the navigation awesome, and it creates a better UX and UI. We will animate the transition of the components. In this part, we are going to add an animation transition to the animated component. Image : require('./assets/images/product6.png'), Image : require('./assets/images/product5.png'), Image : require('./assets/images/product4.png'), Image : require('./assets/images/product3.png'), Image : require('./assets/images/product2.png'), Image : require('./assets/images/product1.png'), You see now that when we click any product’s link it get us to that product! Then loop through the products array in detalils.vue and check the object that matchs the parameter Pid and return its data: Now, when you open the the project in the browser, the first page that will appear is the home page. In our example, we set the home page as the default page. To make any component the default component, set slash(‘/’) to the path property: path:'/' The router method takes an Array of objects which in turn takes each component’s properties: Finally, inside the router folder, we have to configure the routers to make them work.If you have installed Vue with vue-cli, you will have the vue-router module imported by default. Import home from blog from services from contact from Second import Vue and router module from vue-router module: Import all the components using the import method. First import your components into index.js.Now, we have to do some modifications inside the router folder, so open index.js So how we can navigate to each components using the routers? Now after creating these four components, we need to configure the routers so that we can navigate between the components. If you want to do the same thing for the service and contact component, you must have these files in your component folder:
VUE ROUTER BUTTON CODE
Inside the components folder, create new file, name it blog.vue, and push this code into it:

Next, we’re gonna create three other components: Blog, Services and Contact. Click Ctrl + U to view the code source and just copy the Navbar (we just need the navbar). We are now going to add a Bootswatch template. Go to index.js inside the router folder and replace HelloWorld with home:.Remove all the code and replace it with this:

Inside the components folder, open the HellowWorld.vue file and follow these steps: Type the following code in your terminal and run: vue init webpack vue-routerīrowse to Open the app in your text editor. We will be using vue-cli to generate a new Vue.js project. So, let’s get started with our Vue.js Route r project by installing and creating a new Vue.js project. So in this article, I’ll explain how Vue.js routers work by building a Vue template as an example. This is what makes navigation easy and really nice in your web applications. It allows the user to switch between pages without refreshing the page. Vue.js provides a bunch of features that allow you to build reusable web components. It’s used to build single web page apps and flexible components, and it’s one of the most required skills in Front End Web development. Vue.js is a great JavaScript Framework created by Evan You.
