We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-vant
react-vant-icons
3.3.1
No response
DatetimePicker组件在Form组件中,以Popup的方式被调用。此时,如果把Form.Item的trigger设置为onoConfirm时,返回的value不是用户选择的日期。 通过监听DatetimePicker组件的onChange和onConfirm事件发现,如果不设置Form.Item的trigger时,onConfirm返回的value是正确的,但如果设置为onoConfirm时,则返回的value时错误的。
DatetimePicker
Form
Popup
Form.Item
trigger
onoConfirm
value
onChange
onConfirm
const [form] = Form.useForm(); ...... <Form form={form} onFieldsChange={(values) => console.log(values)}> <Form.Item name="beginDate" label="起保日期" isLink trigger="onConfirm" onClick={(e, ref) => { ref?.current?.open(); }} > <DatetimePicker title="选择起保日期" type="date" popup onChange={(value: Date) => console.log(value)} onConfirm={(value: Date) => console.log(value)} > {(value: Date) => (value ? moment(value).format('yyyy-MM-DD') : '请选择起保日期')} </DatetimePicker> </Form.Item> </Form>
效果图: 调试输出:
The text was updated successfully, but these errors were encountered:
感觉可以包一层 把传下来的onchange 事件在onConfirm 调用一次
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Which React Vant packages are impacted?
react-vant
(React Vant core)react-vant-icons
(React Vant Icon)What version of React Vant are you using?
3.3.1
Reproduce live demo(codesandebox or stackblitz)?
No response
Descripition
DatetimePicker
组件在Form
组件中,以Popup
的方式被调用。此时,如果把Form.Item
的trigger
设置为onoConfirm
时,返回的value
不是用户选择的日期。通过监听
DatetimePicker
组件的onChange
和onConfirm
事件发现,如果不设置Form.Item
的trigger
时,onConfirm
返回的value
是正确的,但如果设置为onoConfirm
时,则返回的value
时错误的。效果图:
调试输出:
The text was updated successfully, but these errors were encountered: