修复 搜索组件

This commit is contained in:
yf 2025-01-19 17:32:23 +08:00
parent 94fafa8cab
commit 2ec371bd9a
2 changed files with 7 additions and 3 deletions

View File

@ -97,6 +97,10 @@ const setVisible = () => {
unref(elFormRef)?.resetFields()
visible.value = !unref(visible)
}
defineExpose({
reset,
search
})
</script>
<template>
@ -131,8 +135,8 @@ const setVisible = () => {
<slot name="actionMore"></slot>
</div>
</template>
<template v-for="name in Object.keys($slots)" :key="name" #[name]>
<slot :name="name"></slot>
<template v-for="name in Object.keys($slots)" :key="name" #[name]="data">
<slot :name="name" :data="data" ></slot>
</template>
</Form>

View File

@ -47,7 +47,7 @@ const visible = ref(true)
const newSchema = computed(() => {
let schema: FormSchema[] = cloneDeep(props.schema)
if (props.expand && props.expandField && !unref(visible)) {
const index = findIndex(schema, (v: FormSchema) => props.expandField.indexOf(v.field) === -1)
const index = findIndex(schema, (v: FormSchema) => v.field === props.expandField)
if (index > -1) {
const length = schema.length
schema.splice(index + 1, length)