贴代码先<div v-for="item in currentQuestionTypeList"> {{ item.name }}<el-input-number v-model="item.count" :min="0" :max="10" label=""></el-input-number></div>由于设计需求,此计数器组件的个数需要跟后台数据来确定有多少个;所以无法写死v-model是某个变量;需要与获取到的数据挂钩,但是我这个写法就导致无法点击后增加减少的请问怎么解决呢而在currentQuestionTypeList这个里面我也添加了count这个属性getQuestionType(subject_id) { var that = this; this.loading = true; api.getQuestionType(subject_id).then(response => { that.currentQuestionTypeList = response.data.datalist.filter(function(x){ return ['3','39','7'].indexOf(x.id)>-1 }) that.currentQuestionTypeList.forEach(function(v,i){ v['count']=0 }); //单选题==3 判断题==39 多选题==7 console.log(that.currentQuestionTypeList) })}这个是currentQuestionTypeList的数据
添加回答
举报
0/150
提交
取消