this.$nextTick(() => {
this.$refs.checkform.clearValidate();
})
1、先确定form表单上绑定了
<el-form ref="checkform" label-width="auto" :model="checkform" :rules="rules"></form>
2、如果你得form是放在el-dialog里面的话 先设置Visible=true,再执行文章最开头得代码
<el-dialog title="审核" :visible.sync="Visible" width="80%"></el-dialog>
3、如果你form的数据是通过接口获取到的话,记得把文章 最开头得代码放到接口回调成功里面,也就是form得数据绑定完成之后。
4、完整的代码
<el-dialog title="审核" :visible.sync="Visible" width="80%">
<el-form ref="checkform" label-width="auto" :model="checkform" :rules="rules"></form>`
</el-dialog>
let param = new URLSearchParams();
param.append('billId', ID);
this.$axios.post(this.url, param).then((res) => {
if (res.data.code == "200") {
this.checkform = Object.assign({}, res.data.data);
this.Visible = true;
this.$nextTick(() => {
this.$refs.checkform.clearValidate();
})
}