遍历列表
html代码
<!-- 列表-->
<div >
<p v-for="(item,index) in pageList(数据数组名称) " :key="index" @click="itemId(item.数据对应的名称)">{{item.name(数据对应的名称)}} </p>
</div>
<!-- 展示对应列表里的内容-->
<div class="nav">
</div>
```javascript
import $ from 'jquery'
//需要在data里面定义
data(){
return{
pageList:'',
}
}
created(){
this.query();
},
methods:{
itemId(id){
$('.nav').html(id)
},
query(){
let that = this;
let historyPagevo={};
// 需要传的参数
historyPagevo["entyVo"]={"zylmiputIdval":""};
this.$axios({
method:'POST',
url:'接口地址',
headers: { "Content-Type": "application/json;charset=utf-8" }, //即将被发送的自定义请求头
withCredentials: true ,//即将被发送的自定义请求头
data:historyPagevo
}).then(res => {
// 获取数据
this.pageData = res.data[0].pageList
// console.log( this.pageData)
}).catch(error => {
// console.log(res.data)
//请求失败返回的数据
});
}
}