mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:19:01 +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 source = props.source;
|
||||||
const value = props.value || props.items;
|
const value = props.value || props.items;
|
||||||
let items: Array<object> = [];
|
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;
|
items = value;
|
||||||
|
updateItems = true;
|
||||||
} else if (typeof source === 'string') {
|
} else if (typeof source === 'string') {
|
||||||
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
||||||
const prev = prevProps
|
const prev = prevProps
|
||||||
@ -271,6 +275,7 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||||||
updateItems = false;
|
updateItems = false;
|
||||||
} else if (Array.isArray(resolved)) {
|
} else if (Array.isArray(resolved)) {
|
||||||
items = resolved;
|
items = resolved;
|
||||||
|
updateItems = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,10 +327,14 @@ export default class List extends React.Component<ListProps, object> {
|
|||||||
const source = props.source;
|
const source = props.source;
|
||||||
const value = props.value || props.items;
|
const value = props.value || props.items;
|
||||||
let items: Array<object> = [];
|
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;
|
items = value;
|
||||||
|
updateItems = true;
|
||||||
} else if (typeof source === 'string') {
|
} else if (typeof source === 'string') {
|
||||||
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
||||||
const prev = prevProps
|
const prev = prevProps
|
||||||
@ -341,6 +345,7 @@ export default class List extends React.Component<ListProps, object> {
|
|||||||
updateItems = false;
|
updateItems = false;
|
||||||
} else if (Array.isArray(resolved)) {
|
} else if (Array.isArray(resolved)) {
|
||||||
items = resolved;
|
items = resolved;
|
||||||
|
updateItems = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,9 +479,13 @@ export default class Table extends React.Component<TableProps, object> {
|
|||||||
const source = props.source;
|
const source = props.source;
|
||||||
const value = props.value || props.items;
|
const value = props.value || props.items;
|
||||||
let rows: Array<object> = [];
|
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;
|
rows = value;
|
||||||
} else if (typeof source === 'string') {
|
} else if (typeof source === 'string') {
|
||||||
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
|
||||||
@ -492,6 +496,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|||||||
if (prev && prev === resolved) {
|
if (prev && prev === resolved) {
|
||||||
updateRows = false;
|
updateRows = false;
|
||||||
} else if (Array.isArray(resolved)) {
|
} else if (Array.isArray(resolved)) {
|
||||||
|
updateRows = true;
|
||||||
rows = resolved;
|
rows = resolved;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user