鍍金池/ 問(wèn)答/HTML/ element-ui的計(jì)數(shù)器插件點(diǎn)擊無(wú)法增加和減少

element-ui的計(jì)數(shù)器插件點(diǎn)擊無(wú)法增加和減少

貼代碼先
<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ù)
clipboard.png

回答
編輯回答
呆萌傻

是你的currentQuestionTypeList數(shù)組中的對(duì)象沒(méi)有這個(gè)屬性吧:count

2017年5月16日 21:28
編輯回答
話寡

樓主是怎么解決的,跟你遇到的問(wèn)題一樣,抱緊樓主大腿

2017年7月22日 05:30