From 82f3f22ac428bb58f884bd5d493053e28d6a407c Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Mon, 11 Aug 2025 14:15:49 +0800 Subject: [PATCH] =?UTF-8?q?radio-label=E5=80=BC=E8=8E=B7=E5=8F=96=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/GuipRadio.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/GuipRadio.vue b/src/components/GuipRadio.vue index e937587..07702ec 100644 --- a/src/components/GuipRadio.vue +++ b/src/components/GuipRadio.vue @@ -138,10 +138,16 @@ export default { // 当前选项是否选中 const isSelected = this.getValue(option) === this.selectedValue; - // 选中状态下优先返回selectedLabel,其次返回labelKey指定的属性 - return isSelected && option[this.selectedLabelKey] - ? option[this.selectedLabelKey] - : option[this.labelKey] || option; + // 选中状态下优先返回 selectedLabel + if (isSelected && option[this.selectedLabelKey]) { + return option[this.selectedLabelKey]; + } + + // 明确检查 labelKey 是否存在 + if (typeof option === 'object' && this.labelKey in option) { + return option[this.labelKey]; + } + return option; }, getValue(option) { // 处理对象格式的选项