element-plus/docs/examples/form/utils.ts
云游君 efb48a61fd
fix(style): adjust component size & demo (#4801)
* fix(style): adjust button size & demo spacing

* fix(style): adjust input padding & with prefix/suffix

* fix(style): adjust button padding horizontal

* fix(style): adjust form margin & font-size

* refactor(docs): use setup simplify form examples
2021-12-15 16:36:49 +08:00

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()
}