Vue.js ---- router (routing)

What is routing?

Routing can be seen as a key-value pair, KV.

K => path () path address

V => processing request callback

Reception route

K => path () path address

V => routing component

To use the routing of writing

1. Create a written routing components

2. Configure routing Registration

routes: [ 
{ // generic routing 
path: '/ About' , 
Component: the About 
}, 
{ // automatically jump routing 
path: '/' , 
the redirect: '/ About' 
} 
]

3. Registration configure the router

Configuring your router inside main.js

4. Route

  <Router-link to = "/ xxx"> Go to XXX </ router-link> generates a routed connection
<Router-view> </ router-view> interface to display the current routing component

<Keep-alive> <\ keep-alive> state holding route, the route before the route can record before use state returned

 

 

 

Guess you like

Origin www.cnblogs.com/humiao-0626/p/11544203.html