perf: update useForm hook

This commit is contained in:
陈凯龙
2022-01-28 09:04:17 +08:00
parent 472f574f42
commit 8a958cd71d
5 changed files with 50 additions and 21 deletions

View File

@@ -89,7 +89,9 @@ const schema = reactive<FormSchema[]>([
}
])
const { register, methods, elFormRef } = useForm()
const { register, methods, elFormRef } = useForm({
schema
})
const changeLabelWidth = (width: number | string) => {
const { setProps } = methods
@@ -251,6 +253,6 @@ const verifyReset = () => {
<ElButton @click="verifyReset"> {{ t('formDemo.verifyReset') }} </ElButton>
</ContentWrap>
<ContentWrap :title="`UseForm ${t('formDemo.example')}`">
<Form :schema="schema" @register="register" />
<Form @register="register" />
</ContentWrap>
</template>