场景还原:在el-form-item上绑定的验证并不是el-form-item里面的v-model,而是经过换算的值
code:

<el-form :model="dialogFeedback" :rules="dialogFeedback_rules"  ref="dialogFeedback" :label-position="labelPositionRight" label-width="1.4rem">
        <el-form-item label="问题类型" prop="quesType" ref="quesType">
          <span class="chooseItem" :class="item.selected?'selected':''" @click="chooseQuesType(item.value,index)" v-for="(item,index) in dialogFeedback.quesTypeCodes" :key="index">{{item.label}}</span>
        </el-form-item>
 </el-form>

data:

dialogFeedback:{
        stt:false,
        quesTypeCodes:[],
        quesType:'',
        memo:'',
        name:'',
        phone:'',
        storePic:[],
        editable:false
      },

js

    // 问题类型
    chooseQuesType(quesType,index){
      if(quesType&&this.dialogFeedback.quesTypeCodes ){
        console.log('quesType',quesType)
        for(var qta =0;qta<this.dialogFeedback.quesTypeCodes.length;qta++){
          this.dialogFeedback.quesTypeCodes[qta].selected=0
        }
        this.dialogFeedback.quesTypeCodes[index].selected=1
        this.$set(this.dialogFeedback,'quesType',quesType)
        var sst = this.$refs['quesType'].validate();
        if(!sst){return}
        this.$refs['quesType'].clearValidate();
      }
    },
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45 7 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 7 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐