表格多选框的批量操作和单选操作
1、checkbox设置复选框的只读效果不让用户勾选
<input type="checkbox" name="name" disabled="disabled" />
2、Vue 清除校验
vue2版本
表单
<el-form ref="xxx"></el-form>
method
cleanValidate(formName){
// 清除表单校验的提示
if (this.$refs[formName]) {
// 延时执行
this.$nextTick(function () {
this.$refs[formName].clearValidate();
})
};
},
调用
this.cleanValidate("xxx")
vue3版本
<el-form :model='formData' ref='Formrule' :rules="rules">
<el-form-item label=" " prop="auditDesc">
<el-input
type="textarea"
:rows="2"
placeholder="请输入审批意见"
v-model="formData.auditDesc"
style="width:95%"
></el-input>
</el-form-item>
</el-form>
数据
const state = reactive({
Formrule: null,
formData: {},
rules: {
auditDesc: [
{ required: true, message: '请输入审批意见', trigger: 'blur' },
],
},
}
逻辑处理
// 确认
passDealConfirm() {
state.Formrule.validate(valid => {
if (valid) {
batchMethods.rebut();
}
});
// ploading.value = false;
// batchMethods.rebut();
},
// 取消
passDealCancel() {
state.dialogVisible = false;
state.Formrule.clearValidate();//关闭后清空必填校验
},
效果-点击确认进行拦截确认-必填项