1.導(dǎo)航通過vue-router進行跳轉(zhuǎn), 但是導(dǎo)航的數(shù)據(jù)是動態(tài)可變的, 包括點擊導(dǎo)航的時候需要進行傳參, 自己不知道如何傳參, 麻煩大家?guī)兔匆幌? 謝謝!html <!-- 導(dǎo)航 --> <div class="nav"> <ul> <li @click="typeClick(item.sid)" v-for="item in dictionaryList" :key="item.sid">{{ item.value }}</li> </ul> </div>jsexport default { data() { return { dictionaryList: [] }; }, methods: { dictionaries() { this.$ajax.get(this.$api.DictionaryList + "tour_ype").then(res => { this.dictionaryList = res.data.data.dictionaryList; }); }, typeClick(type) { if (type == 1) { this.climaticLandscape(type); } }, // 天象與氣候景觀 climaticLandscape(type) { console.log("type", type); this.$router.push("/index/tourismresource/climaticlandscape"); }, }, created() { this.dictionaries(); }};router里的index.js // 天象與氣候景觀 { name: 'qhjg', path: '/index/tourismresource/climaticlandscape', component: climaticLandscapeComponent, },在climaticLandscape()里可以打印type傳的值, 但是不知道如何傳參
vue動態(tài)路由切換?
蕪湖不蕪
2019-03-28 22:15:09