In this chapter we will introduce you to Vue.js routing.
Vue.js routing allows us to access different content through different URLs.
Multiple view single page web applications (SPA) can be implemented through Vue.js.
Vue.js routing needs to load vue-router library p>
Chinese document address: vue-router documentation.
1, direct download / CDN
https span> : // unpkg .com/vue-router/dist/vue-router.js
Recommended to use Taobao image:
cnpm install vue - router
Vue.js + vue-router makes it easy to implement single-page applications.
<router-link> is a component that sets up a navigation link to switch between different HTML content. The to attribute is the destination address, which is what you want to display.
In the following example we add vue-router, then configure the components and route maps, and tell vue-router where to render them. The code looks like this:
Clicked navigation links will be styled class ="router-link-exact-active router-link-active"。