feat(dropdown): add dropdown-props prop (#1369)

* feat(dropdown): add dropdown-props prop

* feat: optimization
This commit is contained in:
XieZongChen 2021-10-16 03:10:57 -05:00 committed by GitHub
parent 871e86ed75
commit a2e5f557cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,9 @@
# CHANGELOG
### Feats
- `n-menu` add `dropdown-props` prop, closes [#1345](https://github.com/TuSimple/naive-ui/issues/1345).
## 2.19.8 (2021-10-14)
### Fixes

View File

@ -1,5 +1,9 @@
# CHANGELOG
### Feats
- `n-menu` 新增 `dropdown-props` 属性,关闭 [#1345](https://github.com/TuSimple/naive-ui/issues/1345)
## 2.19.8 (2021-10-14)
### Fixes

View File

@ -35,6 +35,7 @@ customize-field
| default-expanded-keys | `Array<string>` | `[]` | The default expanded submenu keys of menu in uncontrolled manner. |
| default-value | `string \| null` | `null` | Whether selected by default in uncontrolled mode. |
| dropdown-placement | `'top-start' \| 'top' \| 'top-end' \| 'right-start' \| 'right' \| 'right-end' \| 'bottom-start' \| 'bottom' \| 'bottom-end' \| 'left-start' \| 'left' \| 'left-end' \| ` | `'top'` | Only effective in horizontal mode. |
| dropdown-props | `DropdownProps` | `undefined` | The dropdown's props when menu is collapsed or horizontal modeplease see [Dropdown Props](dropdown#API) |
| expanded-keys | `Array<string>` | `undefined` | The expanded submenu keys. If set, menu will work in controlled manner and `default-expanded-names` won't work. |
| expand-icon | `(option: MenuOption) => VNodeChild` | `undefined` | Render function that renders all expand icon. |
| icon-size | `number` | `20` | The icon size when menu is not collapsed. |

View File

@ -35,6 +35,7 @@ customize-field
| default-expanded-keys | `Array<string>` | `[]` | 在非受控状态下默认展开的子菜单标识符数组 |
| default-value | `string \| null` | `null` | 非受控模式下的默认值 |
| dropdown-placement | `'top-start' \| 'top' \| 'top-end' \| 'right-start' \| 'right' \| 'right-end' \| 'bottom-start' \| 'bottom' \| 'bottom-end' \| 'left-start' \| 'left' \| 'left-end' \| ` | `'top'` | 仅在 `mode='horizontal'` 模式下生效 |
| dropdown-props | `DropdownProps` | `undefined` | 菜单折叠或 `mode='horizontal'` 模式时 Dropdown 的 props请参考 [Dropdown Props](dropdown#API) |
| expanded-keys | `Array<string>` | `undefined` | 展开的子菜单标识符数组,如果设定了,菜单的展开将会进入受控状态,`default-expanded-keys` 不会生效 |
| expand-icon | `(option: MenuOption) => VNodeChild` | `undefined` | 批量处理菜单展开图标的渲染 |
| icon-size | `number` | `20` | 菜单未折叠时图标的大小 |

View File

@ -34,6 +34,7 @@ import {
import { layoutSiderInjectionKey } from '../../layout/src/interface'
import { FollowerPlacement } from 'vueuc'
import { useCheckDeprecated } from './useCheckDeprecated'
import { DropdownProps } from '../../dropdown'
const menuProps = {
...(useTheme.props as ThemeProps<MenuTheme>),
@ -106,6 +107,7 @@ const menuProps = {
type: String as PropType<FollowerPlacement>,
default: 'bottom'
},
dropdownProps: Object as PropType<DropdownProps>,
accordion: Boolean,
// deprecated
items: Array as PropType<Array<MenuOption | MenuGroupOption>>,

View File

@ -171,6 +171,7 @@ export default defineComponent({
}
return this.root ? (
<NDropdown
{...this.menuProps?.dropdownProps}
builtinThemeOverrides={{
fontSizeLarge: '14px',
optionIconSizeLarge: '18px'