小编h_a*_*h_a的帖子

更改 Material UI 选择组件边框的颜色不起作用

我使用 Material-ui v5 进行学习。我在覆盖 mui Select 组件的默认样式时遇到困难。我想在将鼠标悬停在 Select 上并且处于聚焦状态时更改 Select 的颜色。目前对焦状态的颜色是这样的。

在此输入图像描述

这是我的代码:

import { useState, useEffect } from 'react';
import { makeStyles } from '@mui/styles';
import { Select, MenuItem } from '@mui/material';

const useStyles = makeStyles({
    select: {
     '&.MuiOutlinedInput-root': {
       width: '200px'
     },
    '& .MuiOutlinedInput-notchedOutline': {
        borderColor: 'red',
          '&:hover': {
          borderColor: 'green'
        }
     },

    }
})

function App() {
  const classes = useStyles();
  const [age, setAge] = useState('');

  const handleChange = (event: SelectChangeEvent) => {
    setAge(event.target.value);
  };
  return (
        <Select …
Run Code Online (Sandbox Code Playgroud)

javascript css reactjs material-ui

3
推荐指数
1
解决办法
5365
查看次数

标签 统计

css ×1

javascript ×1

material-ui ×1

reactjs ×1