-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[table] edit模式失焦多次获取的值异常 #2577
Labels
Comments
👋 @huangpiqiao,感谢给 TDesign 提出了 issue。 |
|
原因分析:表格数据必须有 2 个变量控制,一个是正在输入过程中 保存之前存储的临时变量,一个是原始数据。 methods: {
handleBlur({ rowIndex, editedRow }) {
/**
* 输入框里面输入的数据都是临时变量,存储变更。只有保存成功后,才会真正的改变成表格的数据 data。
* 但此处的做法是还没有保存,就直接改变了的输入框的数据,不符合可编辑单元格保存后才更新表格数据的逻辑。
*/
this.$set(this.data[rowIndex], 'a', String(Number(editedRow.a) + 1));
},
}, |
16 tasks
待 PR #2605 合并后,使用如下示例代码方法更新编辑状态的数据 computed: {
columns() {
return [
{
colKey: 'a',
edit: {
component: Input,
showEditIcon: false,
props: ({ editedRow, updateEditedCellValue }) => {
return {
onBlur: () => this.handleBlur({ editedRow, updateEditedCellValue }),
};
},
},
},
];
},
},
methods: {
handleBlur({ editedRow, updateEditedCellValue }) {
updateEditedCellValue(String(Number(editedRow.a) + 1));
},
}, |
16 tasks
This was referenced Jul 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tdesign-vue 版本
1.4.7
重现链接
https://stackblitz.com/edit/xvkuiw?file=package.json,src%2Fdemo.vue
重现步骤
57bb28744ac2adb2359147bb3dd6fedc.mov
期望结果
每次都能得到结果2
实际结果
第一次得到结果2,第二次以后得到结果1
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
No response
补充说明
No response
The text was updated successfully, but these errors were encountered: