element-ui:非v-model绑定的自身属性的form表单验证
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
场景还原:在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 个月前
更多推荐
已为社区贡献10条内容
所有评论(0)