mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
docs(changelog): menu render-icon change
This commit is contained in:
parent
153ecc9030
commit
7cb72375aa
@ -5,6 +5,7 @@
|
||||
### Feats
|
||||
|
||||
- `n-scrollbar` add `scrollbarWidth`, `scrollbarHeight` and `scrollbarBorderRadius` common theme variables, closes [#649](https://github.com/TuSimple/naive-ui/issues/649).
|
||||
- `n-menu` doesn't should icon placeholder when `render-icon` returns falsy value, closes [#722](https://github.com/TuSimple/naive-ui/issues/722).
|
||||
|
||||
## 2.15.11 (2021-07-29)
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
# CHANGELOG
|
||||
|
||||
## Pending
|
||||
|
||||
### Feats
|
||||
|
||||
- `n-scrollbar` 增加 `scrollbarWidth`、`scrollbarHeight` 和 `scrollbarBorderRadius` 公共主题变量,关闭 [#649](https://github.com/TuSimple/naive-ui/issues/649)
|
||||
- `n-menu` 在 `render-icon` 返回 falsy 值的时候不渲染 icon 的占位符,关闭 [#722](https://github.com/TuSimple/naive-ui/issues/722)
|
||||
|
||||
## 2.15.11 (2021-07-29)
|
||||
|
||||
|
@ -87,7 +87,7 @@ export default defineComponent({
|
||||
style={this.iconStyle}
|
||||
role="none"
|
||||
>
|
||||
{icon === true ? render(this.icon) : icon}
|
||||
{icon}
|
||||
</div>
|
||||
)}
|
||||
<div class={`${clsPrefix}-menu-item-content-header`} role="none">
|
||||
|
@ -49,8 +49,7 @@ describe('n-menu', () => {
|
||||
},
|
||||
{
|
||||
label: 'mojito',
|
||||
key: 'mojito',
|
||||
icon: () => h(NIcon, null, { default: () => h(HappyOutline) })
|
||||
key: 'mojito'
|
||||
},
|
||||
{
|
||||
label: 'initialj',
|
||||
@ -59,7 +58,7 @@ describe('n-menu', () => {
|
||||
]
|
||||
function renderMenuIcon (option: any): any {
|
||||
if (option.key === 'fantasy') return true // render indent
|
||||
if (option.key === 'mojito') return true // keep menu option icon render
|
||||
if (option.key === 'mojito') return true // render indent
|
||||
if (option.key === 'initialj') return null // don't render
|
||||
return h(NIcon, null, { default: () => h(HappyOutline) }) // render this
|
||||
}
|
||||
@ -70,7 +69,7 @@ describe('n-menu', () => {
|
||||
}
|
||||
})
|
||||
expect(wrapper.findAll('.n-menu-item-content__icon').length).toBe(3)
|
||||
expect(wrapper.findAll('.n-icon').length).toBe(2)
|
||||
expect(wrapper.findAll('.n-icon').length).toBe(1)
|
||||
})
|
||||
|
||||
it('should tooltip work with `render-label` props', async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user