后端向前端提的bug
获取当前索引
<el-carousel :autoplay='false' indicator-position='outside' trigger="click" arrow="always" @change="updateIndex">
<el-carousel-item v-for="(form, index) in formList" :key="index">
</el-carousel-item>
</el-carousel>
data(){
currentIndex: 0,
}
updateIndex(num) {
this.currentIndex = num;
this.init()
},
将表单索引值==el-carousel当前索引值
async init() {
const { data } = await GetFormData({ taskId: this.conditions.remark01, formName: this.formTableName })
if (data.data.length == 0) {
this.getFrom()
this.formList = []
this.flag = true
this.formList.push(this.form)
return false
}
if (data.statusCode == 200) {
this.flag = false
data.data.forEach((el, index) => {
if (this.currentIndex == index) {
this.form = el.value
this.form.id = el.id
}
})
const values = data.data.map(item => item.value)
this.formList = values
console.log( this.form ," this.form ");
console.log("formList",this.formList);
}
},