ant design弹出框获取表单数据 | 您所在的位置:网站首页 › antd弹框 › ant design弹出框获取表单数据 |
1.Modal弹出框获取表单数据 const form = React.createRef(); const submit = () => { form.current.submit(); } const onReset = () => { form.current.resetFields(); };form表单 Modal中的按钮获取表单数据:使用 React.createRef() ,引用(Refs)提供了一个获得DOM节点或者创建在render方法中的React元素的方法。表单通过ref来获取数据。 2.Modal弹出框获取表格数据 const [checkedKeys,setCheckedKeys] = useState([]); const columns = [ { title: '序号', key: 'num', render:(text,record,index) => { return {index+1} } }, { title: '用户名', dataIndex: 'username', key: 'username', }, { title: '手机号', dataIndex: mobile', key: 'mobile', }]; const onChange = (selectRowKeys) => { setCheckedKeys(selectRowKeys); } const onOk = () => { //可以拿到checkedKeys做相应的操作 } |
CopyRight 2018-2019 实验室设备网 版权所有 |