【问题标题】:Styles are not applied material UI + Next JS [closed]样式未应用材质 UI + Next JS [关闭]
【发布时间】:2022-02-15 03:20:48
【问题描述】:

我的自定义样式被全局样式覆盖。 我正在使用材质 ui 和下一个 js。

【问题讨论】:

    标签: reactjs material-ui next.js


    【解决方案1】:

    prepend: true 应该添加

    https://codesandbox.io/s/github/mui/material-ui/tree/master/examples/nextjs?file=/src/createEmotionCache.js:0-331

    import createCache from '@emotion/cache';
    
    // prepend: true moves MUI styles to the top of the <head> so they're loaded first.
    // It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
    export default function createEmotionCache() {
      return createCache({ key: 'css', **prepend: true** });
    }
    

    【讨论】:

    • 我现在正在寻找这个答案。谢啦! :) 我花了一整天的时间寻找这个。
    猜你喜欢
    • 2019-06-02
    • 2019-12-22
    • 1970-01-01
    • 2022-07-19
    • 1970-01-01
    • 2020-09-21
    • 1970-01-01
    • 2020-09-13
    • 2019-10-09
    相关资源
    最近更新 更多