From d9b750516a824815bc64918078772a823dc815ed Mon Sep 17 00:00:00 2001 From: RUNZE LU <36724300+lurunze1226@users.noreply.github.com> Date: Thu, 17 Aug 2023 20:19:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20InputText=E7=BB=84=E4=BB=B6autoComplete?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#7869)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/form/input-text.md | 19 +++++++++++++++++++ packages/amis-core/src/store/formItem.ts | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/zh-CN/components/form/input-text.md b/docs/zh-CN/components/form/input-text.md index 50160c89c..aee073ac9 100755 --- a/docs/zh-CN/components/form/input-text.md +++ b/docs/zh-CN/components/form/input-text.md @@ -386,6 +386,25 @@ order: 56 } ``` +## 自动补全 + +```schema: scope="body" +{ + "type": "form", + "debug": true, + "body": [ + { + "name": "name", + "type": "input-text", + "label": "自动补全", + "autoComplete": "/api/mock2/options/autoComplete?term=$term", + "placeholder": "请输入", + "multiple": true + } + ] +} +``` + ## 属性表 当做选择器表单项使用时,除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置 diff --git a/packages/amis-core/src/store/formItem.ts b/packages/amis-core/src/store/formItem.ts index 556f790a3..1baf292dc 100644 --- a/packages/amis-core/src/store/formItem.ts +++ b/packages/amis-core/src/store/formItem.ts @@ -701,7 +701,7 @@ export const FormItemStore = StoreNode.named('FormItemStore') options = normalizeOptions(options as any, undefined, self.valueField); if (config?.extendsOptions && self.selectedOptions.length > 0) { - self.selectedOptions.forEach((item: any) => { + self.filteredOptions.forEach((item: any) => { const exited = findTree( options as any, optionValueCompare(item, self.valueField || 'value'),