一傀蚌、添加404
(1)添加404路由,代表已經(jīng)配置了路由的以外的所有路由蘸吓,路由都是從上往下挨個(gè)匹配善炫,只要有一個(gè)匹配上,下面的就不執(zhí)行库继,所有要放在最下面
routes:[{
path:"*",
component:()=>import('../pages/Error.vue')
}]
###二箩艺、命名路由
```vue
routes:[{
path:"*",
name:''
component:()=>import('../pages/Error.vue')
}]
跳轉(zhuǎn)路由時(shí),根據(jù)路由的名稱去跳轉(zhuǎn)
//params傳值
<router-link :to="{name:'list',params:{type:'abc'}}"></router-link>
//query傳值
<router-link :to="{name:'list2',query:{type:'bcd'}}"></router-link>