A:router路由配置
1 export default new Router({ 2 routes: [ 3 { 4 path: '/home', 5 name: 'Home', 6 component: Home, 7 children:[ 8 {path:'home1',component:Home1}, 9 {path:'home2',component:Home2}, 10 {path:'home3',component:Home3}, 11 {path:'home4',component:Home4}, 12 ], 13 },{ 14 path: '/detail', 15 name: 'detail', 16 component:Detail 17 },{ 18 path:'/',redirect:'/home/home1' 19 } 20 ], 21 linkActiveClass:'ac' 22 })
B.template内部
<li v-for="data in tuijiaList.playlists"> <router-link :to="{path:'/detail',query:{id:data.id}}" > <span>{{data.playCount}}</span><i><img :src="data.coverImgUrl"></i> <p>{{data.name}}</p> </router-link> </li>
C:在detail页面上怎么得到id 值?
this.$route.query.id;