Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Fix `n-menu`'s disabled style not working when parent node is set to `disabled` and child node has `type: "group"`, closes [#6792](https://github.com/tusen-ai/naive-ui/issues/6792)
- Fix `n-input-group-label` not injecting `formItemInjectionKey`, causing the `size` property to fail, and close [#7066](https://github.com/tusen-ai/naive-ui/issues/7066)
- Fix the issue of style confusion in `n-carousel` when there is only one image, close [#6476](https://github.com/tusen-ai/naive-ui/issues/6476)
- Fix `n-select` residual search text issue when using dynamic option creation and selecting options after searching.

### Features

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- 修复 `n-menu` 在父节点设置 `disabled`,子节点为 `type: "group"` 的禁用样式失效,关闭 [#6792](https://github.com/tusen-ai/naive-ui/issues/6792)
- 修复 `n-input-group-label` 没有注入 `formItemInjectionKey`,导致 `size` 属性失效的问题,关闭 [#7066](https://github.com/tusen-ai/naive-ui/issues/7066)
- 修复 `n-carousel` 只有一张图的情況下样式错乱的问题,关闭 [#6476](https://github.com/tusen-ai/naive-ui/issues/6476)
- 修复 `n-select` 在使用动态创建选项功能时,搜索后选择选项导致搜索文本残留的问题

### Features

Expand Down
14 changes: 8 additions & 6 deletions src/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,14 @@ export default defineComponent({
const { value: beingCreatedOptions } = beingCreatedOptionsRef
const beingCreatedOption = beingCreatedOptions[0] || null
if (beingCreatedOption) {
const createdOptions = createdOptionsRef.value
if (!createdOptions.length) {
createdOptionsRef.value = [beingCreatedOption]
}
else {
createdOptions.push(beingCreatedOption)
if (beingCreatedOption[valueField] === option[valueField]) {
const createdOptions = createdOptionsRef.value
if (!createdOptions.length) {
createdOptionsRef.value = [beingCreatedOption]
}
else {
createdOptions.push(beingCreatedOption)
}
}
beingCreatedOptionsRef.value = emptyArray
}
Expand Down