import React, { useState } from 'react';
import {
Button,
TextField,
FormControl,
InputLabel,
Select,
MenuItem,
} from '@mui/material';
const FormComponent = () => {
const [formData, setFormData] = useState({
firstName: '',
lastName: '',
gender: '',
email: '',
});
const [requiredFields, setRequiredFields] = useState([
'firstName',
'lastName',
'email',
]);
const handleChange = (e) => {
const { name, value } = e.target;
setFormData({
...formData,
[name]: value,
});
};
const handleSubmit = () => {
// 检查是否所有必填字段都已填写
const isRequiredFieldsFilled = r