Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How is vue router used in vue.js?


Asked by Holly Stevens on Dec 14, 2021 Vue.js 2.0



Coupled with vue-router, we can build high performance applications with complete dynamic routes. Vue-router is an efficient tool and can efficiently handle authentication in our Vue application. In this tutorial, we will look at using vue-router to handle authentication and access control for different parts of our Vue.js application.
In fact,
Vue Router. Vue Router is the official router for Vue.js . It deeply integrates with Vue.js core to make building Single Page Applications with Vue.js a breeze. Features include: Nested route/view mapping. Modular, component-based router configuration. Route params, query, wildcards.
One may also ask, . Creating a Single-page Application with Vue + Vue Router feels natural: with Vue.js, we are already composing our application with components. When adding Vue Router to the mix, all we need to do is map our components to the routes and let Vue Router know where to render them.
Indeed,
Using <router-view> and <router-link> There are two directives our Vue application gives us to use in our template: <router-view /> - When a route is navigated to in the browser, this is where the component is rendered. For example, in our code going to / will render the Home component where we list <router-view />.
Just so,
Some plugins provided by Vue.js official plugins such as vue-router automatically calls Vue.use () if Vue is available as a global variable. However in a module environment such as CommonJS, you always need to call Vue.use () explicitly: