Skip to content

Commit 0ac9488

Browse files
authored
fix(Select): 修复单选无法新增选项 (#1817)
1 parent db62ee3 commit 0ac9488

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

packages/devui-vue/devui/menu/src/styles/vertical.scss

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
}
77
.#{$devui-prefix}-menu-vertical {
88
padding: 0;
9-
transition:
10-
width $devui-animation-duration-slow $devui-animation-ease-in-smooth,
9+
transition: width $devui-animation-duration-slow $devui-animation-ease-in-smooth,
1110
padding $devui-animation-duration-slow $devui-animation-ease-in-smooth;
1211
border-right: $devui-line 1px solid;
13-
background: $devui-area !important;
1412

1513
::after {
1614
transition: all $devui-animation-duration-fast $devui-animation-ease-in-smooth;
@@ -60,6 +58,12 @@
6058
color: $devui-menu-item;
6159
background: $devui-block;
6260
display: flex;
61+
transition: background-color $devui-animation-duration-fast $devui-animation-ease-in-out-smooth;
62+
63+
&:hover {
64+
color: $devui-list-item-hover-text;
65+
background-color: $devui-list-item-hover-bg;
66+
}
6367

6468
span:nth-child(2) {
6569
// flex: auto;
@@ -88,7 +92,6 @@
8892
padding: 0;
8993
.#{$devui-prefix}-menu-item {
9094
display: flex;
91-
background: $devui-area;
9295

9396
& > span {
9497
flex: auto;
@@ -109,6 +112,12 @@
109112
padding-left: 18px;
110113
align-items: center;
111114
color: $devui-menu-item;
115+
transition: background-color $devui-animation-duration-fast $devui-animation-ease-in-out-smooth;
116+
117+
&:hover {
118+
color: $devui-list-item-hover-text;
119+
background-color: $devui-list-item-hover-bg;
120+
}
112121

113122
&:nth-child(1) {
114123
font-size: $devui-font-size-lg;

packages/devui-vue/devui/select/src/use-select.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default function useSelect(
124124

125125
const getInjectOptions = (values: KeyType<OptionObjectItem, 'value'>[]) => {
126126
return values.map((value) => {
127-
if (props.multiple && props.allowCreate) {
127+
if (props.allowCreate) {
128128
const option = injectOptions.value.get(value);
129129
if (option) {
130130
return option;
@@ -208,6 +208,9 @@ export default function useSelect(
208208
}
209209
getMultipleSelected(checkedItems);
210210
} else {
211+
if (item.create) {
212+
filterQuery.value = '';
213+
}
211214
ctx.emit('update:modelValue', item.value);
212215
getSingleSelected(item);
213216
toggleChange(false);

packages/devui-vue/devui/switch/src/switch.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
width: 100%;
1919
height: 62.5%;
2020
border-radius: $devui-border-radius-full;
21-
background: $devui-line;
21+
background: $devui-shape-icon-fill;
2222
border: 1px solid $devui-line;
2323
position: relative;
2424
display: inline-block;

packages/devui-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-devui",
3-
"version": "1.6.6",
3+
"version": "1.6.7",
44
"license": "MIT",
55
"description": "DevUI components based on Vite and Vue3",
66
"keywords": [

0 commit comments

Comments
 (0)