This commit is contained in:
张成
2025-11-19 15:05:43 +08:00
parent 4a8c9c4a2d
commit 29efa21f0a
2 changed files with 19 additions and 2 deletions

View File

@@ -18,7 +18,7 @@
:col="col"
:value="row[col.key]"
:disabled="getDisabled(col)"
@input="handleFieldInput(col.key, $event)"
@input="handleFieldInput(col.key, $event )"
@change="handleFieldChange(col.key, $event)"
/>
</Row>
@@ -91,11 +91,19 @@ export default {
methods: {
// 处理字段输入事件
handleFieldInput(key, value) {
// 确保接收到的是值而不是事件对象
if (value && typeof value === 'object' && value.target) {
value = value.target.value
}
this.$set(this.row, key, value)
},
// 处理字段变化事件
handleFieldChange(key, value) {
// 确保接收到的是值而不是事件对象
if (value && typeof value === 'object' && value.target) {
value = value.target.value
}
this.$set(this.row, key, value)
},

View File

@@ -10,7 +10,6 @@
:style="getComponentStyle(col.com)"
@input="handleInput"
@on-change="handleChange"
@change="handleChange"
>
<!-- Select 组件的选项 -->
<template v-if="col.com === 'Select'">
@@ -261,6 +260,11 @@ export default {
// 处理输入事件
handleInput(value) {
// 如果接收到的是事件对象,提取值
if (value && typeof value === 'object' && value.target) {
value = value.target.value
}
// 确保 Radio 的值类型正确
if (this.col.com === 'Radio') {
const source = this.getRadioSource(this.col)
@@ -280,6 +284,11 @@ export default {
// 处理变化事件
handleChange(value) {
// 如果接收到的是事件对象,提取值
if (value && typeof value === 'object' && value.target) {
value = value.target.value
}
// 确保 Radio 的值类型正确
if (this.col.com === 'Radio') {
const source = this.getRadioSource(this.col)