Let’s explore how you can use the Vue core package vue-router to implement routing in your web application. We've also added another Vue component router-view which denotes where the views will be placed when the user clicks on a nav item. To learn more about the differences between the Vue 2 and Vue 3 router, check out the readme on the Vue 3 Router library. For example, in the global registration we’ve seen so far: Vue.component('my-component-name', { /* ...The component’s name is the first argument of Vue.component.. # router-view. Component Names. As I showed you … The standard docs don’t seem to explain this very well. Finally, inside the router folder, we have to configure the routers to make them work. We recently talked a little bit about dynamic components in Vue, and this topic is related to our study of the Vue router. This greatly reduces the workload of manually editing the sidebar nav. I’m looking for some more detailed documentation on how vue-router works, particularly with respect to named components, nested components and child routes. Next, we will want to update our Navbar.vue component so that we can hit this newly defined route from within our app itself.. Now, we could update the existing tags to point to this newly defined route, however, it is much better practice to use the tags instead when working within Vue.js as it has been developed to work far more nicely within Vue… While we're here in App.vue, let's give our nav some style in the styles section of the component. The name you give a component may depend on where you intend to use it. This allows Vue Router to change the URL without reloading the page, handle URL generation as well as its encoding. Router and Nav are the key skeleton for organizing a management system. # Router and Nav. This project router and nav are bound together, so you only have to configure the route under @/router/index.js and the sidebar nav will be dynamically generated automatically. What I’m trying to do is decouple behaviour from presentation for a set of complex components. Basically, the components contain more components, and what … We're adding a nav element with two links using the Vue component router-link. When registering a component, it will always be given a name. In other words, with routing we will be switching out different components in the application to achieve the desired effect. If your Vue.js 2 applications grows bigger and consists of multiple views routing becomes a core part of your project. Vue.js is an easy to use web app framework that we can use to develop interactive front end apps. Setup Vue Router. If you have installed Vue with vue-cli, you will have the vue-router module imported by default. https://scotch.io/tutorials/getting-started-with-vue-router The router method takes an Array of objects which in turn takes each component’s properties: If you haven’t installed Vue CLI on your system yet you … Note how instead of using regular a tags, we use a custom component router-link to create links. Vue.js provide bunch of features to build a reusable web components,Routing is one of those methods,it allow user switch between pages without page refreshing the thing that make the navigation easy and really nice in your web application ,so in this Article we are going to explain how Vue.js Routers work by building a Vue- template as example .. Setting Up Our Vue.js 2 Project We’re using Vue CLI to set up our Vue.js project. when we go to /#/ since we have to Foo component assigned to default, Bar component assigned to router-view with name a, and the Baz component assigned to router-view with name b. We will see later how to benefit from these features. Vue Router is a URL router that maps URLs to components. To continue learning Vue Router, you may want to take a read through the Vue 2 documentation.