From 7bcdb461487e937084f58f4fc364afc94f237dbd Mon Sep 17 00:00:00 2001 From: tawen Date: Wed, 14 Jun 2023 06:09:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BD=93=E8=AE=BE?= =?UTF-8?q?=E7=BD=AEapiselect=E7=9A=84immediate=E4=B8=BAfalse=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E8=B5=8B=E5=80=BC=E5=90=8E=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E4=B8=8D=E6=AD=A3=E7=A1=AE=E4=BC=A0=E5=85=A5=E9=BB=98?= =?UTF-8?q?=E8=AE=A4options=E6=96=B9=E6=A1=88=20(#2862)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/components/ApiSelect.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Form/src/components/ApiSelect.vue b/src/components/Form/src/components/ApiSelect.vue index 8239915d..000de3cf 100644 --- a/src/components/Form/src/components/ApiSelect.vue +++ b/src/components/Form/src/components/ApiSelect.vue @@ -55,6 +55,7 @@ valueField: propTypes.string.def('value'), immediate: propTypes.bool.def(true), alwaysLoad: propTypes.bool.def(false), + options: propTypes.array.def([]), }, emits: ['options-change', 'change', 'update:value'], setup(props, { emit }) { @@ -71,7 +72,7 @@ const getOptions = computed(() => { const { labelField, valueField, numberToString } = props; - return unref(options).reduce((prev, next: any) => { + let data = unref(options).reduce((prev, next: any) => { if (next) { const value = get(next, valueField); prev.push({ @@ -82,6 +83,7 @@ } return prev; }, [] as OptionsItem[]); + return data.length > 0 ? data : props.options; }); watchEffect(() => {