[vue3 + elementPlus] Solve the problem of form verification after closing the pop-up window and reopening it

Problem: Open the pop-up window and save it, then reopen the pop-up window to trigger form verification
Solution: When opening the pop-up window, trigger the open function to clear the form verification

 <el-dialog v-model="cardDialogVisible"
      		:title="cardDialogTitle"
      		:before-close="handleCloseCardDialog"
     		@open="handleOpeenCardDialog">
	<el-form ref="formRef" :model="cardList" label-width="80">
		.....
	</el-form>
 </el-dialog>
import {
    
     ref, reactive, onMounted,nextTick } from "vue";

const formRef = ref();
const handleOpeenCardDialog = () => {
    
    
  nextTick(()=>{
    
    
  	// 清空校验
    formRef.value.clearValidate()
  })
}

Guess you like

Origin blog.csdn.net/qq_36687211/article/details/131224434