📜  我们如何设置所需的反应选择 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:39.309000             🧑  作者: Mango

代码示例1
import React from "react";
import { Form, Select, Button } from "antd";
import "./styles.css";
import "antd/dist/antd.css";
const { Option } = Select;

const AppWithForm = props => {
  const { getFieldDecorator } = props.form;

  const handleSubmit = () => {
    props.form.validateFields((err, values) => {
      if (!err) {
        console.log("Received values of form: ", values);
      } else console.log("form is NOT valid");
    });
  };

  const onChange = value => {
    console.log(`selected ${value}`);
  };

  return (
    
{getFieldDecorator("dropdown", { rules: [{ required: true, message: "Please select a person!" }] })( )}
); }; const App = Form.create({})(AppWithForm); export default App;