mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
修复 crud 有可能会重复请求的问题
This commit is contained in:
parent
21ed82dc1d
commit
4371c686be
@ -520,7 +520,18 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
} else if (
|
||||
props.api &&
|
||||
nextProps.api &&
|
||||
isApiOutdated(props.api, nextProps.api, props.data, nextProps.data)
|
||||
isApiOutdated(
|
||||
props.api,
|
||||
nextProps.api,
|
||||
store.fetchCtxOf(props.data, {
|
||||
pageField: props.pageField,
|
||||
perPageField: props.perPageField
|
||||
}),
|
||||
store.fetchCtxOf(nextProps.data, {
|
||||
pageField: nextProps.pageField,
|
||||
perPageField: nextProps.perPageField
|
||||
})
|
||||
)
|
||||
) {
|
||||
this.dataInvalid = true;
|
||||
}
|
||||
|
@ -73,6 +73,21 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
|
||||
|
||||
get selectedItemsAsArray() {
|
||||
return self.selectedItems.concat();
|
||||
},
|
||||
|
||||
fetchCtxOf(
|
||||
data: any,
|
||||
options: {
|
||||
pageField?: string;
|
||||
perPageField?: string;
|
||||
}
|
||||
) {
|
||||
return createObject(data, {
|
||||
...self.query,
|
||||
[options.pageField || 'page']: self.page,
|
||||
[options.perPageField || 'perPage']: self.perPage,
|
||||
...data
|
||||
});
|
||||
}
|
||||
}))
|
||||
.actions(self => {
|
||||
|
Loading…
Reference in New Issue
Block a user