mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 01:41:20 +08:00
19 lines
432 B
TypeScript
19 lines
432 B
TypeScript
|
import type { ElForm } from 'element-plus'
|
||
|
|
||
|
export const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
|
||
|
if (!formEl) return
|
||
|
formEl.validate((valid) => {
|
||
|
if (valid) {
|
||
|
console.log('submit!')
|
||
|
} else {
|
||
|
console.log('error submit!')
|
||
|
return false
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
|
||
|
if (!formEl) return
|
||
|
formEl.resetFields()
|
||
|
}
|