1
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user