javascript - 从大纲输入材料 ui 中删除默认可见性图标
问题描述
我想从大纲输入材料 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>
解决方案
它通过使用下面的css解决了。parentclassname => 父元素的类名。这是一个反应项目。
.parentclassname input[type='password']::-ms-reveal,
.parentclassname input[type='password']::-ms-clear {
display: none;
}
推荐阅读
- spring - WFLYSRV0153:未能处理部署的阶段依赖项
- javascript - AngularJs ng-repeat 中的 iframe 加载事件
- ansible - minishift - 从哪里获取指标的 ansible playbook
- excel - 如何更改手机地址?
- python - OpenCV 对大量图像显示“无”
- django - 更新模型时更新所有相关模型的 datetimefiled
- javascript - 为什么 `video` 元素不会在 Firefox 中触发 `dragstart` 事件?
- logging - 带有 DECLARE 格式参数的 EF Core SQL 日志记录
- ruby-on-rails - 如何跟踪已被杀死的 sidekiq 作业?
- jquery - 如何在 div 和 UL 上给出 tabindex?