import Form from '..'; import Input from '../../input'; import React from 'react'; import ReactDOM from 'react-dom'; const FormItem = Form.Item; const formItemLayout = { labelCol: { fixedSpan: 3 }, wrapperCol: { span: 20 }, }; interface PageStates { code: any; second: number; } class Demo extends React.Component<{}, PageStates> { handleSubmit: (values: any, errors: any) => void; sendCode: (value: any, errors: any, field: any) => void; constructor(props) { super(props); this.state = { code: '', second: 60, }; this.handleSubmit = (values, errors) => { if (errors) { return; } console.log('Get form value:', values); }; this.sendCode = (values, errors) => { if (errors) { return; } this.setState({ code: Math.floor(Math.random() * (999999 - 99999 + 1) + 99999), }); setInterval(() => { let { second } = this.state; this.setState({ second: --second, }); }, 1000); }; } render() { const { code } = this.state; return (
); } } ReactDOM.render(