数组里面多个对象,取其中对象的某个属性值 传入后端作为提交参数
首先 v-if="tab_index == 0" v-for="(item, index) in list data里list: []然后
@click="pendingConsent(item.id)"
然后
// 同意
pendingConsent(id) {
console.log(this.list)
this.consentSubmit(id)
},
然后
// 同意
consentSubmit(id) {
uni.showLoading({
title: "同意中",
mask: true
})
this.http
.request({
method: 'GET',
url: 'center.Pending/pass',
data: {
// 请求参数
apply_id: id
}
})
.then(res => {
console.log(res);
uni.hideLoading()
if (res.data.code == 1) {
uni.showToast({
icon: "none",
title: "同意成功",
duration: 2000
});
} else {
uni.showToast({
icon: "none",
title: res.data.msg,
duration: 2000
});
}
})
.catch(e => {
this.mescroll.endSuccess(0);
uni.hideLoading()
});
},
即可做到data: {
// 请求参数
apply_id: id
}
传入给后端