mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 12:38:53 +08:00
fix: 修复 https://github.com/baidu/amis/pull/2188 带来的问题 (#2197)
This commit is contained in:
parent
638e42d25f
commit
5fbe3b331c
@ -257,10 +257,14 @@ export default class Cards extends React.Component<GridProps, object> {
|
||||
const source = props.source;
|
||||
const value = props.value || props.items;
|
||||
let items: Array<object> = [];
|
||||
let updateItems = true;
|
||||
let updateItems = false;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
(!prevProps || (prevProps.value || prevProps.items) !== value)
|
||||
) {
|
||||
items = value;
|
||||
updateItems = true;
|
||||
} else if (typeof source === 'string') {
|
||||
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
||||
const prev = prevProps
|
||||
@ -271,6 +275,7 @@ export default class Cards extends React.Component<GridProps, object> {
|
||||
updateItems = false;
|
||||
} else if (Array.isArray(resolved)) {
|
||||
items = resolved;
|
||||
updateItems = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,10 +327,14 @@ export default class List extends React.Component<ListProps, object> {
|
||||
const source = props.source;
|
||||
const value = props.value || props.items;
|
||||
let items: Array<object> = [];
|
||||
let updateItems = true;
|
||||
let updateItems = false;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
(!prevProps || (prevProps.value || prevProps.items) !== value)
|
||||
) {
|
||||
items = value;
|
||||
updateItems = true;
|
||||
} else if (typeof source === 'string') {
|
||||
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
||||
const prev = prevProps
|
||||
@ -341,6 +345,7 @@ export default class List extends React.Component<ListProps, object> {
|
||||
updateItems = false;
|
||||
} else if (Array.isArray(resolved)) {
|
||||
items = resolved;
|
||||
updateItems = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -479,9 +479,13 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
const source = props.source;
|
||||
const value = props.value || props.items;
|
||||
let rows: Array<object> = [];
|
||||
let updateRows = true;
|
||||
let updateRows = false;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
(!prevProps || (prevProps.value || prevProps.items) !== value)
|
||||
) {
|
||||
updateRows = true;
|
||||
rows = value;
|
||||
} else if (typeof source === 'string') {
|
||||
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
||||
@ -492,6 +496,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
if (prev && prev === resolved) {
|
||||
updateRows = false;
|
||||
} else if (Array.isArray(resolved)) {
|
||||
updateRows = true;
|
||||
rows = resolved;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user