如何在react js上获取DateRangePicker(同步融合)的值 [英] How to get the value of DateRangePicker (syncfusion) on react js

查看:33
本文介绍了如何在react js上获取DateRangePicker(同步融合)的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个来自 Syncfusion 的日期范围选择器,我安装了该包并将组件导入到我的 React 项目中.我对 DateRangePicker 非常陌生,所以我想知道如何获得 DateRangePicker 的值.

I have a date range picker from Syncfusion, I installed the package and import the component to my react project. I'm pretty much new to DateRangePicker, so I wonder how can I get the value of the DateRangePicker.

这是我的代码

import React from 'react'
import './DateRangePicker.css'
import {DateRangePickerComponent} from '@syncfusion/ej2-react-calendars'

function DateRangePicker(){
    return(
        <>
            <DateRangePickerComponent></DateRangePickerComponent>
        </>
    )
}

export default DateRangePicker

输出如下:

推荐答案

你可以通过一个 prop 来获取 DateRangePickerComponent 的值:更改

You can get the value of DateRangePickerComponent by pass a prop: change

function DateRangePicker(){
    const onChange = (props) => {
        const stateDate = props.startDate;
        const endDate = props.endDate;

    };
    return(
        <>
            <DateRangePickerComponent change={onChange} />
        </>
    )
}

这篇关于如何在react js上获取DateRangePicker(同步融合)的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆