Skip to content

Commit

Permalink
feat(select): adds header slot (#5449)
Browse files Browse the repository at this point in the history
Co-authored-by: 07akioni <[email protected]>
  • Loading branch information
jahnli and 07akioni authored Dec 18, 2023
1 parent cb61fd3 commit 1b11276
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- `n-select` 支持 RTL
- `n-data-table` 支持 RTL
- `n-dialog` 支持 RTL
- `n-select` 新增 `header` 插槽,关闭 [#5448](https://github.com/tusen-ai/naive-ui/issues/5448)

## 2.36.0

Expand Down
3 changes: 3 additions & 0 deletions src/select/demos/enUS/action.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Is there anybody who needs an action slot on a select menu?
</markdown>
<template>
<n-select v-model:value="value" :options="options">
<template #header>
Don't know what to put
</template>
<template #action>
If you click this demo, you may need it.
</template>
Expand Down
11 changes: 6 additions & 5 deletions src/select/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ custom-field.vue

### Select Slots

| Name | Parameters | Description | Version |
| ------ | ---------- | -------------------------------------- | ------- |
| action | `()` | Options menu slot. | |
| empty | `()` | Empty state slot for the options menu. | |
| arrow | `()` | Arrow icon slot. | 2.24.2 |
| Name | Parameters | Description | Version |
| ------ | ---------- | -------------------------------------- | ------------ |
| header | `()` | Header menu slot. | NEXT_VERSION |
| action | `()` | Options menu slot. | |
| empty | `()` | Empty state slot for the options menu. | |
| arrow | `()` | Arrow icon slot. | 2.24.2 |

### Select Methods

Expand Down
3 changes: 3 additions & 0 deletions src/select/demos/zhCN/action.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

<template>
<n-select v-model:value="value" :options="options">
<template #header>
不知道放些什么
</template>
<template #action>
如果你点开了这个例子,你可能需要它
</template>
Expand Down
11 changes: 6 additions & 5 deletions src/select/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ create-debug.vue

### Select Slots

| 名称 | 参数 | 说明 | 版本 |
| ------ | ---- | ------------------- | ------ |
| action | `()` | 菜单操作区域的 slot | |
| empty | `()` | 菜单无数据时的 slot | |
| arrow | `()` | 箭头的 slot | 2.24.2 |
| 名称 | 参数 | 说明 | 版本 |
| ------ | ---- | ------------------- | ------------ |
| header | `()` | 菜单头部区域的 slot | NEXT_VERSION |
| action | `()` | 菜单操作区域的 slot | |
| empty | `()` | 菜单无数据时的 slot | |
| arrow | `()` | 箭头的 slot | 2.24.2 |

### Select Methods

Expand Down
1 change: 1 addition & 0 deletions src/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ export default defineComponent({
>
{{
empty: () => [this.$slots.empty?.()],
header: () => [this.$slots.header?.()],
action: () => [this.$slots.action?.()]
}}
</NInternalSelectMenu>,
Expand Down

0 comments on commit 1b11276

Please sign in to comment.