docs(components): check docs before stable (#5740)

This commit is contained in:
C.Y.Kun
2022-01-31 23:43:56 +08:00
committed by GitHub
parent 4501b6dd66
commit b46bdae9e6
103 changed files with 1244 additions and 767 deletions

View File

@ -35,11 +35,10 @@
<script lang="ts" setup>
import { ref, reactive } from 'vue'
// More info see https://github.com/element-plus/element-plus/blob/dev/docs/examples/form/utils.ts
import { resetForm, submitForm } from './utils'
import type { ElForm } from 'element-plus'
const ruleFormRef = ref<InstanceType<typeof ElForm>>()
type FormInstance = InstanceType<typeof ElForm>
const ruleFormRef = ref<FormInstance>()
const checkAge = (rule: any, value: any, callback: any) => {
if (!value) {
@ -90,4 +89,21 @@ const rules = reactive({
checkPass: [{ validator: validatePass2, trigger: 'blur' }],
age: [{ validator: checkAge, trigger: 'blur' }],
})
const submitForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.validate((valid) => {
if (valid) {
console.log('submit!')
} else {
console.log('error submit!')
return false
}
})
}
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.resetFields()
}
</script>