fix: autoExpandParent 未生效问题

This commit is contained in:
yangchch6 2020-03-05 15:07:57 +08:00
parent ae18db0834
commit 046a7ae8eb
4 changed files with 4 additions and 7 deletions

View File

@ -172,8 +172,7 @@ var Tree = function (_React$Component) {
return !prevProps && name in nextProps || prevProps && prevProps[name] !== nextProps[name];
}
// ================ expandedKeys =================
// if (needSync('expandedKeys') || (prevProps && needSync('autoExpandParent'))) {
if (needSync('expandedKeys')) {
if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent') || prevProps && prevProps['expandedKeys'] !== expandedKeys) {
st.expandedKeys = expandedKeys;
} else if (!prevProps && props.defaultExpandAll || !prevProps && props.defaultExpandedKeys) {
st.expandedKeys = this.getDefaultExpandedKeys(nextProps);

3
dist/demo.js vendored
View File

@ -34454,8 +34454,7 @@
return !prevProps && name in nextProps || prevProps && prevProps[name] !== nextProps[name];
}
// ================ expandedKeys =================
// if (needSync('expandedKeys') || (prevProps && needSync('autoExpandParent'))) {
if (needSync('expandedKeys')) {
if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent') || prevProps && prevProps['expandedKeys'] !== expandedKeys) {
st.expandedKeys = expandedKeys;
} else if (!prevProps && props.defaultExpandAll || !prevProps && props.defaultExpandedKeys) {
st.expandedKeys = this.getDefaultExpandedKeys(nextProps);

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -118,8 +118,7 @@ class Tree extends React.Component {
return (!prevProps && name in nextProps) || (prevProps && prevProps[name] !== nextProps[name]);
}
// ================ expandedKeys =================
// if (needSync('expandedKeys') || (prevProps && needSync('autoExpandParent'))) {
if (needSync('expandedKeys')) {
if (needSync('expandedKeys') || (prevProps && needSync('autoExpandParent')) || (prevProps && prevProps['expandedKeys'] !== expandedKeys)) {
st.expandedKeys = expandedKeys;
} else if ((!prevProps && props.defaultExpandAll) || (!prevProps && props.defaultExpandedKeys)) {
st.expandedKeys = this.getDefaultExpandedKeys(nextProps);