Routing profile
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
Copy the code
Path is the url mapping of the current route. Component Displays the component content in the specified display area when switching to path for the current route. Configure word redirect in the Childen array to redirect the current route
Vue route redirection
Enter the path in the to attribute of the router-link tag
this.$router.push()
- this.$router.push({path:’/router’})
- this.$router.push({name:’router’})
Route parameter Transmission (suppose the route jumps from B to C)
- Configure an identifier on the route to be jumped
{
path:'/c/:x'
}
Copy the code
- The router-link tag in B carries parameters in the to attribute
<router-link :to="'/c/'+item.name">{{item.name}}</router-link>
Copy the code
- Accept arguments in C using $router.params
<div>{{$route.params.x}}</div>
Copy the code
Params pass parameters (list jumps to detail)
- Enable the props receive mode in the detail