diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index a2e055e9c..befae4517 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -76,6 +76,7 @@ const InputNumber = defineComponent({ emit('focus', e); }; return () => { + const id = props.id ?? formItemContext.id.value; const { class: className, bordered, @@ -86,7 +87,7 @@ const InputNumber = defineComponent({ prefix = slots.prefix?.(), valueModifiers = {}, ...others - } = { ...attrs, ...props } as InputNumberProps & HTMLAttributes; + } = { ...attrs, ...props, id } as InputNumberProps & HTMLAttributes; const preCls = prefixCls.value;