亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue路由中怎么傳入數據

vue路由中怎么傳入數據

繁華開滿天機 2018-12-04 05:04:36
vue路由中怎么傳入數據
查看完整描述

1 回答

?
米琪卡哇伊

TA貢獻1998條經驗 獲得超6個贊

動態路由,然后用$route.params去獲取路由對象里的信息
詳情可以去看vue router的官方文檔
下面是我最近寫的例子
route.js

export 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.vue

created(){
this.fetch();
this.title = this.$route.params.category.toUpperCase();
}



查看完整回答
反對 回復 2018-12-21
  • 1 回答
  • 0 關注
  • 617 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號