mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:39:05 +08:00
fix: 修复 Table 中调用 setData 报错问题 (#9578)
This commit is contained in:
parent
d6208f8d05
commit
6ef0248c29
@ -80,6 +80,16 @@ export const Item = types
|
||||
reset() {
|
||||
self.newIndex = self.index;
|
||||
self.data = self.pristine;
|
||||
},
|
||||
updateData({children, ...rest}: any) {
|
||||
self.data = {
|
||||
...self.data,
|
||||
...rest
|
||||
};
|
||||
|
||||
// if (Array.isArray(children)) {
|
||||
|
||||
// }
|
||||
}
|
||||
}));
|
||||
|
||||
|
@ -466,7 +466,7 @@ export const Row = types
|
||||
self.loaded = false;
|
||||
},
|
||||
|
||||
setDeferData({children, ...rest}: any) {
|
||||
updateData({children, ...rest}: any) {
|
||||
self.data = {
|
||||
...self.data,
|
||||
...rest
|
||||
|
@ -779,7 +779,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
|
||||
row.setDeferData(response.data);
|
||||
row.updateData(response.data);
|
||||
row.markLoaded(true);
|
||||
row.setError('');
|
||||
} catch (e) {
|
||||
@ -2888,7 +2888,6 @@ export class TableRenderer extends Table {
|
||||
condition?: any
|
||||
) {
|
||||
const {store} = this.props;
|
||||
const len = store.data.rows.length;
|
||||
|
||||
if (index !== undefined) {
|
||||
let items = [...store.data.rows];
|
||||
@ -2901,6 +2900,7 @@ export class TableRenderer extends Table {
|
||||
return store.updateData({rows: items}, undefined, replace);
|
||||
} else if (condition !== undefined) {
|
||||
let items = [...store.data.rows];
|
||||
const len = items.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const item = items[i];
|
||||
const isUpdate = await evalExpressionWithConditionBuilder(
|
||||
|
Loading…
Reference in New Issue
Block a user