mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 04:28:32 +08:00
nav 父节点的 unfolded 需要依赖子节点的 active (#1960)
Co-authored-by: cy <chenyi08@kuaishou.com>
This commit is contained in:
parent
bad661528a
commit
d94fbddeb3
@ -231,27 +231,32 @@ const ConditionBuilderWithRemoteOptions = withRemoteConfig({
|
||||
if (Array.isArray(links) && motivation !== 'toggle') {
|
||||
const {data, env, unfoldedField, foldedField} = props;
|
||||
|
||||
links = mapTree(links, (link: Link) => {
|
||||
const item: any = {
|
||||
...link,
|
||||
...getExprProperties(link, data as object),
|
||||
active:
|
||||
(motivation !== 'location-change' && link.active) ||
|
||||
(link.activeOn
|
||||
? evalExpression(link.activeOn as string, data)
|
||||
: !!(
|
||||
link.hasOwnProperty('to') &&
|
||||
env &&
|
||||
env.isCurrentUrl(filter(link.to as string, data))
|
||||
))
|
||||
};
|
||||
links = mapTree(
|
||||
links,
|
||||
(link: Link) => {
|
||||
const item: any = {
|
||||
...link,
|
||||
...getExprProperties(link, data as object),
|
||||
active:
|
||||
(motivation !== 'location-change' && link.active) ||
|
||||
(link.activeOn
|
||||
? evalExpression(link.activeOn as string, data)
|
||||
: !!(
|
||||
link.hasOwnProperty('to') &&
|
||||
env &&
|
||||
env.isCurrentUrl(filter(link.to as string, data))
|
||||
))
|
||||
};
|
||||
|
||||
item.unfolded =
|
||||
isUnfolded(item, {unfoldedField, foldedField}) ||
|
||||
(link.children && link.children.some(link => !!link.active));
|
||||
item.unfolded =
|
||||
isUnfolded(item, {unfoldedField, foldedField}) ||
|
||||
(link.children && link.children.some(link => !!link.active));
|
||||
|
||||
return item;
|
||||
});
|
||||
return item;
|
||||
},
|
||||
1,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
return links;
|
||||
|
Loading…
Reference in New Issue
Block a user