element-ui的计数器插件点击无法增加和减少

贴代码先
<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的数据
clipboard.png

阅读 7.2k
3 个回答

是你的currentQuestionTypeList数组中的对象没有这个属性吧:count

新手上路,请多包涵

楼主是怎么解决的,跟你遇到的问题一样,抱紧楼主大腿

我也遇到了,不知道这是组件设计缺陷还是啥意思呢,楼主解决了没有,请赐教。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题