From 9bd1fdc45beeafa5ed2702fb4d1c811b60f9c801 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Fri, 10 Jun 2022 23:28:49 +0800 Subject: [PATCH] feat(tree-select): adds `arrow` slot, closes #3084 --- CHANGELOG.en-US.md | 6 ++++++ CHANGELOG.zh-CN.md | 6 ++++++ src/tree-select/demos/enUS/index.demo-entry.md | 9 +++++---- src/tree-select/demos/zhCN/index.demo-entry.md | 9 +++++---- src/tree-select/src/TreeSelect.tsx | 6 +++++- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index c1205519796..bf8510991f3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,5 +1,11 @@ # CHANGELOG +## NEXT_VERSION + +### Feats + +- `n-tree-select` adds `arrow` slot, closes [#3084](https://github.com/TuSimple/naive-ui/issues/3084). + ## 2.30.3 ### Fixes diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 4f4eb6e1107..9a4fbd5c0e7 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,5 +1,11 @@ # CHANGELOG +## NEXT_VERSION + +### Feats + +- `n-tree-select` 新增 `arrow` slot,关闭 [#3084](https://github.com/TuSimple/naive-ui/issues/3084) + ## 2.30.3 ### Fixes diff --git a/src/tree-select/demos/enUS/index.demo-entry.md b/src/tree-select/demos/enUS/index.demo-entry.md index 1ac88489efc..7e23bd41c9f 100644 --- a/src/tree-select/demos/enUS/index.demo-entry.md +++ b/src/tree-select/demos/enUS/index.demo-entry.md @@ -74,7 +74,8 @@ debug.vue ### TreeSelect Slots -| Name | Parameters | Description | Version | -| ------ | ---------- | -------------------------------------- | ------- | -| action | `()` | Options menu slot. | 2.22.0 | -| empty | `()` | Empty state slot for the options menu. | 2.22.0 | +| Name | Parameters | Description | Version | +| ------ | ---------- | -------------------------------------- | ------------ | +| action | `()` | Options menu slot. | 2.22.0 | +| arrow | `()` | Arrow icon of trigger. | NEXT_VERSION | +| empty | `()` | Empty state slot for the options menu. | 2.22.0 | diff --git a/src/tree-select/demos/zhCN/index.demo-entry.md b/src/tree-select/demos/zhCN/index.demo-entry.md index 14e4dae7963..892b6c720b8 100644 --- a/src/tree-select/demos/zhCN/index.demo-entry.md +++ b/src/tree-select/demos/zhCN/index.demo-entry.md @@ -76,7 +76,8 @@ field-search-debug.vue ### TreeSelect Slots -| 名称 | 参数 | 说明 | 版本 | -| ------ | ---- | ------------------- | ------ | -| action | `()` | 菜单操作区域的 slot | 2.22.0 | -| empty | `()` | 菜单无数据时的 slot | 2.22.0 | +| 名称 | 参数 | 说明 | 版本 | +| ------ | ---- | ------------------- | ------------ | +| action | `()` | 菜单操作区域的 slot | 2.22.0 | +| arrow | `()` | 选择箭头 slot | NEXT_VERSION | +| empty | `()` | 菜单无数据时的 slot | 2.22.0 | diff --git a/src/tree-select/src/TreeSelect.tsx b/src/tree-select/src/TreeSelect.tsx index c80db05ae5f..8b4eb784b9e 100644 --- a/src/tree-select/src/TreeSelect.tsx +++ b/src/tree-select/src/TreeSelect.tsx @@ -710,7 +710,11 @@ export default defineComponent({ onDeleteOption={this.handleDeleteOption} onKeydown={this.handleKeydown} onKeyup={this.handleKeyup} - /> + > + {{ + arrow: () => [this.$slots.arrow?.()] + }} + ) }} ,