我想从outlineinput material ui中删除默认的可见性图标。当输入类型为密码时,会显示一个默认的可见性图标。我想把它去掉。我正在使用自定义可见性图标的inputAdorment。
这是我的代码..
<FormControl variant="outlined">
<InputLabel htmlFor="outlined-adornment-password">
What’s your current password?
</InputLabel>
<OutlinedInput
id="outlined-adornment-password"
type={showCurrentPsw ? 'text' : 'password'}
value={currentPassword}
name="currentpsw"
onChange={({ target: { value } }) => {
setCurrentPassword(value);
value !== '' &&
value.trim() !== '' &&
setCurrentPswdEmpty(false);
}}
error={currentPswdEmpty}
label="What’s your current password?"
required
endAdornment={
<InputAdornment position="end">
<IconButton
aria-label="What’s your current password?"
onClick={() => {
setShowCurrentPsw(!showCurrentPsw);
}}
edge="end"
>
{showCurrentPsw ? (
<Visibility />
) : (
<VisibilityOff />
)}
</IconButton>
</InputAdornment>
}
/>
</FormControl>

发布于 2021-04-21 19:29:30
它通过使用下面的css解决。parentclassname父元素的=>类名。这是一个react项目。
.parentclassname input[type='password']::-ms-reveal,
.parentclassname input[type='password']::-ms-clear {
display: none;
}https://stackoverflow.com/questions/67194368
复制相似问题