在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 請問怎么把v-for遍歷里的對象保存到data里,以便methods里的方法調(diào)用

請問怎么把v-for遍歷里的對象保存到data里,以便methods里的方法調(diào)用?

clipboard.png
我用v-for遍歷了一個數(shù)組
之前用的動態(tài)路由傳參的方式傳遞detail里的對象,成功!
clipboard.png
但是寫到后面感覺太繁瑣了,想用編程式路由,但是要怎么獲取到detail里的值呢?
我這樣寫的

clipboard.png
但是值為空,
有人說可以用索引值方式獲取,但是我寫不來,第一次寫項目,求大神指點。。

回答
編輯回答
薔薇花

template:

<div v-for="detail in details" @click="toRouter(detail)"></div>

methods:

toRouter (detail) {
    this.$router.push({path: '/comment', query: {table: detail}})
}
2018年7月13日 18:24
編輯回答
真難過
this.$router.push({path:'/comment',query{table:this.detail}});

跳轉(zhuǎn)頁面獲取
this.$route.query.table
2017年6月14日 10:15