如何删除下拉列表中的默认多选值

问题描述 投票:0回答:0

在此代码中自动选择多个一个值如何隐藏此值 import { Input, Button, Form, Select, Upload } from "antd";

                <Col md={12}>
                <FormGroup>
                  <Label>Contest type</Label>
                  <Form.Item
                    name="contest_type_2"
                    rules={[
                      {
                        required: true,
                        message: "This field is required",
                      },
                    ]}
                  >
                    <Select
                      mode="multiple"
                      placeholder="Contest Type"
                      className="basic-single"
                      style={{
                        width: "100%",
                      }}
                      onChange={handleChange}
                      menuItemSelectedIcon={
                        <CheckSquareOutlined
                          style={{
                            color: "#d32f2f",
                          }}
                        />
                      }
                      removeIcon={<CloseSquareOutlined style={{ color: "#d32f2f" }} />}
                    >
                    
                      {contest_category_options?.map((option) => (
                        
                        <Select.Option key={option.value} value={option.value}>
                          <span className="type_option">{option.label}</span>
                        </Select.Option>
                      ))}
                    </Select>
                  </Form.Item>
                  {/* <Select
                    options={contest_category_options}
                    className="basic-single"
                    isMulti
                    // {...register("contest_category", { required: `This field is required` })}
                    placeholder="Enter Contest Name"
                  ></Select> */}
                </FormGroup>
              </Col>

我想知道如何在这个下拉列表中删除自动选择的值

your text

html reactjs api jsx tsx
© www.soinside.com 2019 - 2024. All rights reserved.