命名路由和命名视图
命名路由和命名视图
1)命名路由+传参
<router-link :to="{name:'test1'}">命名路由</router-link> //**注意:1、‘:to’ 既 to前必加: 2、后面的名字必须加‘’
<router-link :to="{name:'test1',params:{testId:123}}">命名传参路由</router-link>
path:'/test1/:testId'
取值:{{$route.params.testId}}
2)命名视图
<router-view name="view1"></router-view>
<router-view name="view2"></router-view>
components:{
default:GoodsList,
view1:Title,
view2:Image
}