ok,所以我有一个功能组件,它实际上是一个迷你文本编辑器。它允许用户选择字体、字体大小和颜色。此表单包含以下 TextField 元素。
<Box
sx={{
"& .MuiTextField-root": { marginTop: 3, width: "80ch" },
}}
noValidate
autoComplete="off"
>
<div>
<TextField
id="textMessage"
name="textMessage"
label="Message"
multiline={true}
rows={6}
defaultValue={mainMessageText}
onChange={handleChangeText}
//onBlur={handleBlur}
//helperText={touched.message ? errors.message : ""}
//error={touched.message && Boolean(errors.message)}
inputProps={{
maxLength: 320,
minLength: 9,
style: {
//fontWeight: boldButtonState ? "bold" : "",
//fontStyle: italicButtonState ? "italic" : "",
//fontSize: fontSize,
//fontFamily: selectedFont,
lineHeight: "1em",
//textDecoration: underlinedButtonState ? "underline" : "",
//color: fontColor,
},
}}
/>
</div>
</Box>
在我的其他功能组件之一中,我正在尝试按照以下方式在 Formik 下使用上述文本编辑器子组件。当我提交表单时,handleSubmit 事件没有 textMessage 的值。是否存在我错过了什么? 我用过这种类型的 su