fix: IDLPAD

This commit is contained in:
xingyu4j
2026-01-26 11:06:38 +08:00
parent a0019cef04
commit 02c977f969
2 changed files with 19 additions and 2 deletions

View File

@@ -18,6 +18,12 @@ import { ElNotification } from 'element-plus';
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { FileUpload, ImageUpload } from '#/components/upload';
const AutoComplete = defineAsyncComponent(() =>
Promise.all([
import('element-plus/es/components/autocomplete/index'),
import('element-plus/es/components/autocomplete/style/css'),
]).then(([res]) => res.ElAutocomplete),
);
const ElButton = defineAsyncComponent(() =>
Promise.all([
import('element-plus/es/components/button/index'),
@@ -178,6 +184,7 @@ export type ComponentType =
| 'ApiCascader'
| 'ApiSelect'
| 'ApiTreeSelect'
| 'AutoComplete'
| 'Checkbox'
| 'CheckboxGroup'
| 'DatePicker'
@@ -243,6 +250,7 @@ async function initComponentAdapter() {
visibleEvent: 'onVisibleChange',
},
),
AutoComplete,
Checkbox: ElCheckbox,
CheckboxGroup: (props, { attrs, slots }) => {
let defaultSlot;

View File

@@ -166,8 +166,17 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'AutoComplete',
componentProps: {
clearable: true,
filterOption(input: string, option: { value: string }) {
return option.value.toLowerCase().includes(input.toLowerCase());
fetchSuggestions(queryString: string, cb: any) {
const options = componentKeys.map((v) => ({ value: v }));
const createFilter = (qs: string) => {
return (restaurant: any) => {
return restaurant.value.toLowerCase().includes(qs.toLowerCase());
};
};
const results = queryString
? options.filter(createFilter(queryString))
: options;
cb(results);
},
placeholder: '请选择组件名称',
options: componentKeys.map((v) => ({ value: v })),