This commit is contained in:
张成
2025-11-19 15:43:45 +08:00
parent 9a93a6dc99
commit af16450eb6

View File

@@ -93,24 +93,8 @@ export default {
}
},
computed: {
// 确保 Radio 的值类型正确
// 直接返回原始值,不进行类型转换
radioValue() {
if (this.col.com === 'Radio') {
const source = this.getRadioSource(this.col)
if (source.length > 0 && this.value !== undefined && this.value !== null) {
const firstItem = source[0]
const firstValue = this.getRadioValue(firstItem)
// 如果第一个选项的值是数字类型,确保 value 也是数字
if (typeof firstValue === 'number') {
return Number(this.value)
}
// 如果第一个选项的值是字符串类型,确保 value 也是字符串
if (typeof firstValue === 'string') {
return String(this.value)
}
}
}
return this.value
}
},
@@ -264,21 +248,7 @@ export default {
if (value && typeof value === 'object' && value.target) {
value = value.target.value
}
// 确保 Radio 的值类型正确
if (this.col.com === 'Radio') {
const source = this.getRadioSource(this.col)
if (source.length > 0) {
const firstItem = source[0]
// 如果第一个选项的值是数字类型,确保 value 也是数字
const firstValue = this.getRadioValue(firstItem)
if (typeof firstValue === 'number' && typeof value === 'string') {
value = Number(value)
} else if (typeof firstValue === 'string' && typeof value === 'number') {
value = String(value)
}
}
}
// 直接传递值,不进行类型转换
this.$emit('input', value)
},
@@ -288,21 +258,7 @@ export default {
if (value && typeof value === 'object' && value.target) {
value = value.target.value
}
// 确保 Radio 的值类型正确
if (this.col.com === 'Radio') {
const source = this.getRadioSource(this.col)
if (source.length > 0) {
const firstItem = source[0]
// 如果第一个选项的值是数字类型,确保 value 也是数字
const firstValue = this.getRadioValue(firstItem)
if (typeof firstValue === 'number' && typeof value === 'string') {
value = Number(value)
} else if (typeof firstValue === 'string' && typeof value === 'number') {
value = String(value)
}
}
}
// 直接传递值,不进行类型转换
this.$emit('change', value)
}
}