fix(menu): tooltip content doesn't follow render-label when collapsed (#308)

* fix(menu): render-label on collapsed

* docs: add changelog

* Apply suggestions from code review

Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
cyn 2021-06-27 21:30:25 +08:00 committed by GitHub
parent 3d48a7c711
commit c47bd3fd09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@
- Fix `n-date-picker` `n-provider` pass `date-locale` not work, closes [#250](https://github.com/TuSimple/naive-ui/issues/250).
- Fix `n-input` clear button placeholder prevent clicking on actual component [#288](https://github.com/TuSimple/naive-ui/issues/288)
- Fix `n-carousel` click the at current item button, the component behaves abnormally.
- Fix `n-menu` `render-label` not working for tooltip in collapsed mode.
## 2.14.0 (2021-06-23)

View File

@ -17,6 +17,7 @@
- 修复 `n-date-picker` `n-provider` 传递 `date-locale` 属性无效,关闭 [#250](https://github.com/TuSimple/naive-ui/issues/250)
- Fix `n-input` clear button placeholder prevent clicking on actual component [#288](https://github.com/TuSimple/naive-ui/issues/288)
- 修复 `n-carousel` 点击当前页对应的控制按钮时,组件显示异常
- 修复 `n-menu` 折叠时 `render-label` 对于 tooltip 不生效
## 2.14.0 (2021-06-23)

View File

@ -51,6 +51,7 @@ export default defineComponent({
maxIconSize: MenuChild.maxIconSize,
activeIconSize: MenuChild.activeIconSize,
mergedTheme: NMenu.mergedThemeRef,
menuProps,
dropdownEnabled: useMemo(() => {
return (
props.root &&
@ -71,7 +72,11 @@ export default defineComponent({
}
},
render () {
const { mergedClsPrefix, tmNode } = this
const {
mergedClsPrefix,
tmNode,
menuProps: { renderLabel }
} = this
return (
<div
role="menuitem"
@ -91,7 +96,8 @@ export default defineComponent({
disabled={!this.dropdownEnabled || this.title === undefined}
>
{{
default: () => render(this.title),
default: () =>
renderLabel ? renderLabel(tmNode.rawNode) : render(this.title),
trigger: () => (
<NMenuOptionContent
tmNode={tmNode}