在页面加载时,已保存的凭据会自动填充,并且它们与 mui 文本字段组件的占位符重叠
我使用 useEffect 在页面渲染时触发点击事件,但它不影响文本字段,并且我也尝试了 autoFocus prop,但它也不起作用
<TextField
id={id}
fullWidth
autoFocus={autofocus}
name={name}
style={customStyles}
label={label}
variant={variant}
type={showPassword ? "text" : type}
value={value}
onChange={handleOnChange}
onBlur={onBlur}
error={error}
helperText={helperText}
placeholder={placeholder}
onKeyDown={handleKeyDown}
slotProps={{
input: {
autoComplete: autocomplete,
...(type === "password" && {
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label={
showPassword
? "hide the password"
: "display the password"
}
onClick={handleClickShowPassword}
onMouseDown={handleMouseDownPassword}
onMouseUp={handleMouseUpPassword}
edge="end"
>
{showPassword ? (
<VisibilityOff titleAccess={t(wordings.hidePassword)} />
) : (
<Visibility titleAccess={t(wordings.showPassword)} />
)}
</IconButton>
</InputAdornment>
),
}),
},
}}