首页 > 解决方案 > 更改文本字段 onFocus mui 的背景颜色

问题描述

  1. 在此处输入图像描述

========================================

当日历打开但无法找出方法时,我正在尝试更改输入类型日期的背景颜色。这是代码

  dateInputRoot: {
    '&:hover': {
      backgroundColor: '#EBEBEB',
    },

    '&:active': {
      backgroundColor: '#fff',
      borderColor: '#2EFF22',
      borderWidth: 1,
    },
  },
  dateInput: {
    border: 0,
  },

               <TextField
                  margin="dense"
                  type="date"
                  variant="outlined"
                  value={closeDate}
                  placeholder=""
                  fullWidth
                  style={{ paddingLeft: 0 }}
                  onChange={(e) => {
                    setCloseDate(e.target.value);
                  }}
                  className={classes.dateInputRoot}
                  InputProps={{
                    classes: { notchedOutline: classes.dateInput },
                  }}
                />

问题在于活动选择器它只会改变背景,直到我按下鼠标按钮也没有应用borderWidth。我想在日历打开时为白色和一些边框提供背景。请提供任何帮助

标签: cssreactjsmaterial-uijss

解决方案


推荐阅读