From 50d55e7086db86e4a305bc66c6da7c56c5250d59 Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Thu, 17 Jul 2025 11:27:25 +0800 Subject: [PATCH] =?UTF-8?q?select=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E7=B1=BB=E5=9E=8B=E3=80=81=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/GuipSelect.vue | 7 +++++++ src/views/elementGroups.vue | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/GuipSelect.vue b/src/components/GuipSelect.vue index d0e5667..e43a309 100644 --- a/src/components/GuipSelect.vue +++ b/src/components/GuipSelect.vue @@ -61,6 +61,13 @@ export default { processedOptions() { // 处理options为空的情况 let options = this.options || []; + // 如果是 [1,12,22] 格式 + if (Array.isArray(options) && options.every(item => typeof item !== 'object')) { + return options.map((item, index) => ({ + [this.valueKey]: index, + [this.labelKey]: item + })); + } // 如果是对象格式,转换为数组 if (options && !Array.isArray(options)) { diff --git a/src/views/elementGroups.vue b/src/views/elementGroups.vue index e7ddb92..c2be0a3 100644 --- a/src/views/elementGroups.vue +++ b/src/views/elementGroups.vue @@ -75,12 +75,17 @@ value-key="id" />