c 可以做网站吗,在哪里申请网站域名,互联网行业黑话,电子商务网站建设基础项目实训报告作用
简化路由的跳转,适合在路径过长的时候使用#xff08;例如#xff1a;path:/a/b/c/d/e/f/...#xff09; 如何理解#xff1a;相当于给路径起别名
使用方式
给路由命名
//创建一个路由器
const router new VueRouter({routes:[......{path:/home,component:HomeV…作用
简化路由的跳转,适合在路径过长的时候使用例如path:/a/b/c/d/e/f/... 如何理解相当于给路径起别名
使用方式
给路由命名
//创建一个路由器
const router new VueRouter({routes:[......{path:/home,component:HomeVue,children:[{path:news,/*二级路由不用写斜杠*/component:NewsVue},{path:message,component:MessageVue,children:[{name:detailName,path:detail,component:DetailVue},]}],}],
})简化跳转
!--简化前--
router-link to/home/message/detail详情页/router-link
!--简化后--
router-link :to{name:detailName}详情页/router-link
!--简化配合传递参数--
router-link :to{name:detailName,query:{id:666,title:hello}
}详情页/router-link切记
使用命名路由时,要使用 v-bind:to来解析js对象对象中声明name属性