1. Navigation jumps through vue-router, but the navigation data is dynamically variable, including the need to pass parameters when you click on navigation. You don"t know how to pass parameters. Please take a look at them.
html
<!-- -->
<div class="nav">
<ul>
<li @click="typeClick(item.sid)" v-for="item in dictionaryList" :key="item.sid">{{ item.value }}</li>
</ul>
</div>
js
export 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();
}
};
index.js in router
//
{
name: "qhjg",
path: "/index/tourismresource/climaticlandscape",
component: climaticLandscapeComponent,
},
you can print the value passed by type in climaticLandscape (), but you don"t know how to pass the parameter
.