fix: 修复Search组件无法默认值

This commit is contained in:
xingyu4j
2022-11-21 16:34:38 +08:00
parent dfb24dda81
commit 33fbe43ff6
5 changed files with 17 additions and 5 deletions

View File

@ -33,7 +33,11 @@ const props = defineProps({
expand: propTypes.bool.def(false),
// 伸缩的界限字段
expandField: propTypes.string.def(''),
inline: propTypes.bool.def(true)
inline: propTypes.bool.def(true),
model: {
type: Object as PropType<Recordable>,
default: () => ({})
}
})
const emit = defineEmits(['search', 'reset'])
@ -62,7 +66,9 @@ const newSchema = computed(() => {
return schema
})
const { register, elFormRef, methods } = useForm()
const { register, elFormRef, methods } = useForm({
model: props.model || {}
})
const search = async () => {
await unref(elFormRef)?.validate(async (isValid) => {