Skip to content

Commit ce15306

Browse files
committed
feat(Search): 增加悬浮发光效果
1 parent cedd6f5 commit ce15306

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

packages/devui-vue/devui/search/src/composables/use-search-class.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ export const useSearchClass = (props: SearchProps, isFocus: Ref<boolean>): UseSe
2424
[ns.m('focus')]: isFocus.value,
2525
[ns.m('disabled')]: props.disabled,
2626
[ns.m('no-border')]: props.noBorder,
27+
[ns.m('glow-style')]: props.showGlowStyle,
2728
[ns.m(searchSize.value)]: !!searchSize.value,
2829
[ns.m(props.iconPosition)]: ICON_POSITION[props.iconPosition],
2930
}));
3031

3132
return {
3233
rootClass,
33-
searchSize
34+
searchSize,
3435
};
3536
};

packages/devui-vue/devui/search/src/search-types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type IconPosition = 'right' | 'left';
55

66
export const searchProps = {
77
size: {
8-
type: String as PropType<Size>
8+
type: String as PropType<Size>,
99
},
1010
placeholder: {
1111
type: String,
@@ -51,6 +51,10 @@ export const searchProps = {
5151
type: Function as PropType<(v: string) => void>,
5252
default: undefined,
5353
},
54+
showGlowStyle: {
55+
type: Boolean,
56+
default: true,
57+
},
5458
} as const;
5559

5660
export type SearchProps = ExtractPropTypes<typeof searchProps>;

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
.#{$devui-prefix}-search {
66
position: relative;
7+
border-radius: $devui-border-radius;
8+
transition: border-color 0.3s $devui-animation-ease-in-out-smooth, box-shadow $devui-animation-duration-base $devui-animation-ease-in;
79
@include flex;
810

9-
&:not(.#{$devui-prefix}-search--error):not(.#{$devui-prefix}-search--disabled):not(.#{$devui-prefix}-search--focus):hover {
11+
&:not(.#{$devui-prefix}-search--error):not(.#{$devui-prefix}-search--disabled):not(.#{$devui-prefix}-search--focus):not(.#{$devui-prefix}-search--glow-style):hover {
1012
.#{$devui-prefix}-input {
1113
border-color: $devui-form-control-line-hover;
1214
}
@@ -99,6 +101,15 @@
99101
top: 0;
100102
}
101103

104+
&--glow-style {
105+
&:not(.#{$devui-prefix}-search--disabled) {
106+
&:hover,
107+
&.#{$devui-prefix}-search--focus {
108+
box-shadow: 0 0 0 4px $devui-form-control-interactive-outline;
109+
}
110+
}
111+
}
112+
102113
&--sm {
103114
.#{$devui-prefix}-input {
104115
height: $devui-size-sm;

packages/devui-vue/devui/search/src/search.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default defineComponent({
4646
maxlength: props.maxLength,
4747
modelValue: keywords.value,
4848
placeholder: props.placeholder || t('placeholder'),
49+
showGlowStyle: false,
4950
onKeydown: onInputKeydown,
5051
'onUpdate:modelValue': onInputUpdate,
5152
onFocus: onFocus,

packages/devui-vue/docs/components/search/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export default defineComponent({
107107
| icon-position | [IconPositionType](#iconpositiontype) | 'right' | 可选,搜索图标位置 | [搜索图标左置](#搜索图标左置) |
108108
| no-border | `boolean` | false | 可选,是否显示边框 | [无边框](#无边框) |
109109
| css-class | `string` | '' | 可选,支持传入类名到输入框上 | [双向绑定](#双向绑定) |
110+
|show-glow-style|`boolean`|true|可选,是否显示悬浮发光效果||
110111

111112
### Search 事件
112113

@@ -123,6 +124,7 @@ type SearchSizeType = 'sm' | 'md' | 'lg';
123124
```
124125

125126
#### IconPositionType
127+
126128
```ts
127129
type IconPositionType = 'right' | 'left';
128130
```

0 commit comments

Comments
 (0)