有没有办法将日历日期选择器中所选日期绑定到另一个文件可以访问的变量?
我正在开发一个 React 应用程序,目前有一个日期选择器可以使用 Ant Design 选择日期范围。我想将所选日期的值存储到一个变量中,该变量可以由程序中的另一个文件访问。如何将选定的值绑定到变量中?以下是我的日期选择器的 JavaScript 代码:
<p>Select a date range: </p>
</div>
<div className="left">
<Space direction="vertical" size={12}>
<RangePicker
format="YYYY-MM-DD"
onChange={this.onChange}
onOk={onOk}
/>
</Space>
I am working on a React application and currently have a date picker to select a date range using Ant Design. I want to store the value of the selected date into a variable that can be accessed by another file in my program. How can I bind the selected value into a variable? Here is the JavaScript code for my date picker:
<p>Select a date range: </p>
</div>
<div className="left">
<Space direction="vertical" size={12}>
<RangePicker
format="YYYY-MM-DD"
onChange={this.onChange}
onOk={onOk}
/>
</Space>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查以下示例,您可以在选择日期后将日期值存储在变量中,并调用
onChange
函数。screenshot
Check the following example, You can store the date values in a variable once the date is selected and
onChange
function is called.Screenshot