fix: IDLPAD
This commit is contained in:
@@ -18,6 +18,12 @@ import { ElNotification } from 'element-plus';
|
|||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { FileUpload, ImageUpload } from '#/components/upload';
|
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(() =>
|
const ElButton = defineAsyncComponent(() =>
|
||||||
Promise.all([
|
Promise.all([
|
||||||
import('element-plus/es/components/button/index'),
|
import('element-plus/es/components/button/index'),
|
||||||
@@ -178,6 +184,7 @@ export type ComponentType =
|
|||||||
| 'ApiCascader'
|
| 'ApiCascader'
|
||||||
| 'ApiSelect'
|
| 'ApiSelect'
|
||||||
| 'ApiTreeSelect'
|
| 'ApiTreeSelect'
|
||||||
|
| 'AutoComplete'
|
||||||
| 'Checkbox'
|
| 'Checkbox'
|
||||||
| 'CheckboxGroup'
|
| 'CheckboxGroup'
|
||||||
| 'DatePicker'
|
| 'DatePicker'
|
||||||
@@ -243,6 +250,7 @@ async function initComponentAdapter() {
|
|||||||
visibleEvent: 'onVisibleChange',
|
visibleEvent: 'onVisibleChange',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
AutoComplete,
|
||||||
Checkbox: ElCheckbox,
|
Checkbox: ElCheckbox,
|
||||||
CheckboxGroup: (props, { attrs, slots }) => {
|
CheckboxGroup: (props, { attrs, slots }) => {
|
||||||
let defaultSlot;
|
let defaultSlot;
|
||||||
|
|||||||
@@ -166,8 +166,17 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'AutoComplete',
|
component: 'AutoComplete',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
clearable: true,
|
||||||
filterOption(input: string, option: { value: string }) {
|
fetchSuggestions(queryString: string, cb: any) {
|
||||||
return option.value.toLowerCase().includes(input.toLowerCase());
|
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: '请选择组件名称',
|
placeholder: '请选择组件名称',
|
||||||
options: componentKeys.map((v) => ({ value: v })),
|
options: componentKeys.map((v) => ({ value: v })),
|
||||||
|
|||||||
Reference in New Issue
Block a user