Skip to content

Commit

Permalink
fix(Filed): onclick label execute twice (#11838)
Browse files Browse the repository at this point in the history
* fix(Filed): onclick label execute twice

* fix(Filed): onclick label execute twice

* Update Field.tsx

---------

Co-authored-by: zyc <1439655764>
Co-authored-by: neverland <[email protected]>
  • Loading branch information
13725102796 and chenjiahan authored May 14, 2023
1 parent d05972d commit ca59be8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vant/src/field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,11 @@ export default defineComponent({
<label
id={`${id}-label`}
for={getInputId()}
onClick={(event: MouseEvent) => {
// https://github.com/youzan/vant/issues/11831
preventDefault(event);
focus();
}}
style={
labelAlign === 'top' && labelWidth
? { width: addUnit(labelWidth) }
Expand Down

0 comments on commit ca59be8

Please sign in to comment.