nav 控件支持在 expandIcon 中获取菜单的当前状态(例如 isOpen)
- Dominant language
- TypeScript
- Stars
- 18.9k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
#### 是否关联于某个问题吗:
自定义expandIcon时,可以用表达式区分菜单的展开状态,例如:
#### 预期的解决方案:
目前传入参数没有效果
```json
{
"type": "nav",
"stacked": true,
"expandIcon": {
"type": "icon",
"icon": "${isOpen? 'far fa-angle-down':'far fa-angle-right'}"
},
}
```
#### 任何附加信息:
相关源码
https://github.com/baidu/amis/blob/master/packages/amis-ui/src/components/menu/index.tsx#L534
可用参数包括:
```js
renderExpandIcon(ctx: {
isSelected?: boolean;
isOpen?: boolean;
isSubMenu?: boolean;
disabled?: boolean;
[propName: string]: any;
})
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at packages/amis-ui/src/components/menu/index.tsx around the referenced line and trace how renderExpandIcon receives its context. Verify how the nav component renders expandIcon expressions, then make the requested current menu state available so isOpen can distinguish expanded and collapsed menus. Confirm the example configuration produces the corresponding icons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100