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" />
- +
+ + +
+