gpt4 book ai didi

javascript - Material-UI:提供给 createMuiTheme 的阴影数组应该支持 25 个高度

转载 作者:行者123 更新时间:2023-12-04 17:15:22 25 4
gpt4 key购买 nike

我正在尝试消除 Material-UI 主题中的阴影。

我找到了 answer here with fixed the problem .但是,我在此问题的标题中收到错误消息。

const theme = createMuiTheme({
palette: {
primary: {
light: red[300],
main: red[500],
dark: red[700]
},
secondary: {
light: red.A200,
main: red.A400,
dark: red.A700
}
},
shadows: ['none']
});

错误:

browser.js:49 Warning: Material-UI: the shadows array provided to createMuiTheme should support 25 elevations.



我找到了这个解决方案,但答案没有帮助:
https://github.com/mui-org/material-ui/issues/8289

最佳答案

看起来它希望您的主题至少有 25 个阴影,以便创建在 Material UI 中看到的进度。如果您尝试遵循 Material UI 标准,我当然不建议您移除阴影,但一种简单的方法可能是将所有高度级别设置为 none。 .

const theme = createMuiTheme({
palette: {
primary: {
light: red[300],
main: red[500],
dark: red[700]
},
secondary: {
light: red.A200,
main: red.A400,
dark: red.A700
}
},
shadows: Array(25).fill('none')
});
这应该满足要求。
编辑 :
正如 Dave 所指出的,如果您使用的是 TypeScript,请记住进行转换:
shadows: Array(25).fill('none') as Shadows

关于javascript - Material-UI:提供给 createMuiTheme 的阴影数组应该支持 25 个高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50516398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com