Vue 命名路由,简化路由的路径path
1、作用
简化多级路由
2、设置
src/router/index.js
在路由中添加 name 关键字
children:[ { name:'detail', path:'detail', component: DetailData }, ]
3、使用,配合传递参数,或者单个name关键字
to要绑定 :to,并且使用name 关键字
<router-link :to="{ // path:'/home/message/detail', name:'detail', query:{ // key value id:m.id, title:m.title } }"

浙公网安备 33010602011771号