fix(Input): the input cannot focus when mouse pressed on the prefix or suffix

pull/7981/head
Hitsuki9 2024-12-19 15:33:38 +08:00 committed by wangxin
parent 4a37016f4e
commit 0285481fec
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ export default defineComponent({
props: baseInputProps(),
setup(props, { slots, attrs }) {
const containerRef = ref();
const onInputMouseDown: MouseEventHandler = e => {
const onInputClick: MouseEventHandler = e => {
if (containerRef.value?.contains(e.target as Element)) {
const { triggerFocus } = props;
triggerFocus?.();
@ -104,7 +104,7 @@ export default defineComponent({
class={affixWrapperCls}
style={attrs.style as CSSProperties}
hidden={!hasAddon({ addonAfter, addonBefore }) && hidden}
onMousedown={onInputMouseDown}
onClick={onInputClick}
ref={containerRef}
>
{prefix && <span class={`${prefixCls}-prefix`}>{prefix}</span>}