mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-26 19:36:36 +08:00
types(Search): fix missing event typing (#10134)
This commit is contained in:
parent
ac85f82f09
commit
e36081d68a
@ -40,7 +40,15 @@ export default defineComponent({
|
|||||||
|
|
||||||
props: searchProps,
|
props: searchProps,
|
||||||
|
|
||||||
emits: ['search', 'cancel', 'update:modelValue'],
|
emits: [
|
||||||
|
'blur',
|
||||||
|
'focus',
|
||||||
|
'clear',
|
||||||
|
'search',
|
||||||
|
'cancel',
|
||||||
|
'click-input',
|
||||||
|
'update:modelValue',
|
||||||
|
],
|
||||||
|
|
||||||
setup(props, { emit, slots, attrs }) {
|
setup(props, { emit, slots, attrs }) {
|
||||||
const id = useId();
|
const id = useId();
|
||||||
@ -91,6 +99,10 @@ export default defineComponent({
|
|||||||
|
|
||||||
const blur = () => filedRef.value?.blur();
|
const blur = () => filedRef.value?.blur();
|
||||||
const focus = () => filedRef.value?.focus();
|
const focus = () => filedRef.value?.focus();
|
||||||
|
const onBlur = (event: Event) => emit('blur', event);
|
||||||
|
const onFocus = (event: Event) => emit('focus', event);
|
||||||
|
const onClear = (event: MouseEvent) => emit('clear', event);
|
||||||
|
const onClickInput = (event: MouseEvent) => emit('click-input', event);
|
||||||
|
|
||||||
const fieldPropNames = Object.keys(fieldSharedProps) as Array<
|
const fieldPropNames = Object.keys(fieldSharedProps) as Array<
|
||||||
keyof typeof fieldSharedProps
|
keyof typeof fieldSharedProps
|
||||||
@ -110,7 +122,11 @@ export default defineComponent({
|
|||||||
type="search"
|
type="search"
|
||||||
class={bem('field')}
|
class={bem('field')}
|
||||||
border={false}
|
border={false}
|
||||||
|
onBlur={onBlur}
|
||||||
|
onFocus={onFocus}
|
||||||
|
onClear={onClear}
|
||||||
onKeypress={onKeypress}
|
onKeypress={onKeypress}
|
||||||
|
onClick-input={onClickInput}
|
||||||
onUpdate:modelValue={onInput}
|
onUpdate:modelValue={onInput}
|
||||||
{...fieldAttrs}
|
{...fieldAttrs}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user