【问题标题】:Theme not Changing in `AppBar of material-UI?Material-UI的`AppBar中的主题没有改变?
【发布时间】:2020-07-07 08:58:26
【问题描述】:

我正在尝试使用状态更改材质 UI AppBar 的主题,但主题没有改变,但图标会改变。

这里是代码链接:https://codesandbox.io/s/relaxed-bird-n30bg?file=/src/App.js

【问题讨论】:

    标签: javascript css reactjs material-ui


    【解决方案1】:

    :)

    在 App.js 中,有一个错字 -- palette 应该是 palette

    const theme = createMuiTheme({
        palette: { //<---here
          type: themeMode,
          primary: {
            main: themeMode === "light" ? "#3f51b5" : "#333333"
          }
        }
      });
    

    我已经检查并修复了错字,一切正常

    【讨论】:

      猜你喜欢
      • 2019-10-07
      • 2020-12-11
      • 2018-12-02
      • 2021-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-06
      • 1970-01-01
      相关资源
      最近更新 更多