貼代碼先<div v-for="item in currentQuestionTypeList"> {{ item.name }}<el-input-number v-model="item.count" :min="0" :max="10" label=""></el-input-number></div>由于設(shè)計(jì)需求,此計(jì)數(shù)器組件的個(gè)數(shù)需要跟后臺(tái)數(shù)據(jù)來(lái)確定有多少個(gè);所以無(wú)法寫(xiě)死v-model是某個(gè)變量;需要與獲取到的數(shù)據(jù)掛鉤,但是我這個(gè)寫(xiě)法就導(dǎo)致無(wú)法點(diǎn)擊后增加減少的請(qǐng)問(wèn)怎么解決呢而在currentQuestionTypeList這個(gè)里面我也添加了count這個(gè)屬性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) })}這個(gè)是currentQuestionTypeList的數(shù)據(jù)
element-ui的計(jì)數(shù)器插件點(diǎn)擊無(wú)法增加和減少
小唯快跑啊
2019-03-13 12:12:04