vue路由中怎么传入数据

vue路由中怎么传入数据


繁华开满天机
浏览 592回答 1
1回答

米琪卡哇伊

动态路由,然后用$route.params去获取路由对象里的信息详情可以去看vue router的官方文档下面是我最近写的例子route.jsexport default new Router({routes: [{path: '/',name: 'index',component: index},{path: '/list/:category',name: "list",component: list,meta: { id: 'list-kind' }}]})parent.vue<router-link :to="{ path: './list/learn'}" tag="section" class="item"><img src="../assets/h5_icon_1.png" alt="Subject Learn"><p>It is a learning fairyland for Chinese learners</p></router-link>child.vuecreated(){this.fetch();this.title = this.$route.params.category.toUpperCase();}
打开App,查看更多内容
随时随地看视频慕课网APP