- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 mui 的 List 组件,只是安装了所需的依赖项。
错误是
TypeError: theme.palette is undefined
./node_modules/@mui/material/ListItem/ListItem.js/ListItemRoot<
node_modules/@mui/material/ListItem/ListItem.js:85
我的组件非常简单,它只是返回带有 ListItem 的列表项。该组件由带有元素属性的 react-router-dom 中的 Route 标签呈现
ProductList.jsx
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
import { data } from "./data.json"
export const ProductsList = () => {
return (
<List>
<ListItem>
content
</ListItem>
</List>
)
}
在硬编码路径“/217/cerveza-script”App.js 上呈现的组件
import React from 'react';
import {
Routes,
Route,
useLocation
} from "react-router-dom";
import { AdminHome } from "./admin/AdminHome"
import { NavbarAdmin } from '../components/admin/NavbarAdmin';
import { ClientsView } from "./admin/ClientsView"
import { NewClient } from './admin/NewClient';
import { Profile } from './Profile';
import { Settings } from "./admin/Settings";
import { Employees } from './owner/Employees';
import { OwnerHome } from './owner/OwnerHome';
import { Box } from '@chakra-ui/layout';
import { ProductsList } from '../components/menu/ProductsList';
const App = () => {
return (
<Box backgroundColor="gray.50" style={{height: "100vh"}}>
<NavbarAdmin />
<Routes>
<Route exact path="/" element={ <AdminHome />}/>
<Route exact path="/owner" element={ <OwnerHome />}/>
<Route path="/clientes" element={ <ClientsView />}/>
<Route path="/nuevousuario" element={ <NewClient />}/>
<Route path="/perfil" element={ <Profile/> }/>
<Route path="/ajustes" element={ <Settings /> }/>
<Route path="/empleados" element={ <Employees /> }/>
<Route path="/217/cerveza-script" element={ <ProductsList /> }/>
</Routes>
</Box>
)
};
export default App;
我还在其余的 ui 组件中使用 ChakraUI(仅将 mui 用于列表和表格)
包.json
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@chakra-ui/icons": "^1.1.1",
"@chakra-ui/react": "^1.7.2",
"@emotion/react": "^11.6.0",
"@emotion/styled": "^11.3.0",
"@material-ui/core": "^4.12.3",
"@mui/material": "^5.0.6",
"@reduxjs/toolkit": "^1.6.2",
"@testing-library/jest-dom": "^5.15.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.24.0",
"framer-motion": "^4.1.17",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.3.1",
"react-redux": "^7.2.6",
"react-router-dom": "^6.0.2",
"react-scripts": "4.0.3",
"redux-logger": "^3.0.6",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
编辑:发布了错误的 package.json
最佳答案
在您的 ProductList.js
中,从 @material-ui/core/
导入 List
和 ListItem
而不是@mui/material/
.
改变这个,
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
对此,
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
关于javascript - Material ui TypeError : palette. 主题未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70120053/
我有一个 AsyncTask,它从 url 加载位图并使用调色板更改我的 float 操作按钮的背景。对于大多数图像,它工作正常,但在某些图像上它会使按钮透明。屏幕截图 1 显示按钮颜色使用图像中的蓝
我认为这是一个非常新手的问题,但我不明白。我正在尝试向我的页面添加一个 Wicket 口调色板。 根据wicket examples和 mkyong.com这应该很容易。 我坚持这个 List lis
我正在尝试在我的 Android 应用程序中实现 Palette 类,但是 Android Studio 无法将 Palette 识别为一个类。我尝试了 import android.support.
从 seaborn docs 运行以下示例带参数 palette='jet' import seaborn as sns tips = sns.load_dataset("tips") ax = sn
我简单的第一个调色板是假设: 将我的包路径附加到 $Path ActionMenu["test",{"The Simple Packages Path":> AppendTo[$Path, ToFil
我正在使用 react-palette 来提取鲜艳的颜色。我在渲染方法中有这个: {palette => {
我正在尝试使用 TBitmap.Palette 从 8 位位图中提取颜色。我的颜色乱了,我不知道为什么。我创建了一个简单的视觉测试来比较结果: 我正在使用的代码: procedure TForm36.
我有一个由 Swing 编写的项目。 我将该项目导入 Intellij Idea 12。 但是当我检查“ View ”->“工具窗口”->“调色板”选项时,该选项被禁用。 我对 Java Swing
我有一些 session 初始化代码,可以为每个 session 加载“Notation”包。这会调出 Notation Palette。知道如何防止它,或添加代码以自动摆脱它吗? OK,belisa
这很简单:我想在不禁用项目的情况下模仿被禁用的项目的颜色变化。 有 QTableWidgetItem 和 QStandardItem 项目,我正在使用这样的代码 item->setForeground
我在 Palette 中有比框宽更宽的元素。元素的尾端被剪掉并且不可见。调色板具有自动垂直滚动,但没有水平滚动。如何使水平滚动成为可能? 这是我在我的 css 上尝试过的。 DIV.t-palette
我最近使缓存无效并重新启动了 Android Studio 3.1,因为从 3.0.1 升级到 3.1 给了我 gradle 构建错误,这里的另一个答案建议了该方法。 我的 gradle 现在将构建,
是否可以将您在项目中创建的自定义小部件和布局显示为布局编辑器中工具选项板的一部分? 有一个名为“自定义和库 View ”的部分是空的,带有一个刷新按钮。 最佳答案 自定义布局要求 要使自定义布局出现在
我正在尝试使用 mui 的 List 组件,只是安装了所需的依赖项。 错误是 TypeError: theme.palette is undefined ./node_modules/@mui/mat
我有一个简单的问题.. 我想知道什么是搜索风格,比如我在研究时如何指代这种搜索风格。 在 Sublime Text 3 中,当您按下 Ctrl+ Shift + P 时,命令面板会弹出,您可以输入搜索
我正在使用 Eclipse 3.6,并且想要将 Richfaces 添加到 Palette。有人可以提供源代码或解释如何操作吗? 最佳答案 http://labs.jboss.com/tools/ 就
我正在从位图中生成调色板。我正在确保我得到一个有效的充满活力的样本并将文本颜色设置为该样本的 getTitleTextColor() .文档说: Returns an appropriate colo
首先,我使用的是 OpenGL ES 1.1 而不是 2.0,主要是因为我花了很多时间学习 1.0/1.1 并且对它非常满意。 我花时间学习了矩阵调色板在动画中的使用,在切换项目的齿轮后我遇到了一个问
基于theming guide您可以为我们的示例定义自定义主题 accent。第二个参数将覆盖 $mat-pink 默认为 A200,但是第三个 ($lighter) 和第四个 ($darker)参数
所以在 Angular Material 2 中,我设置了主题 $store-primary: mat-palette($mat-storecast); $store-accent: mat-pal
我是一名优秀的程序员,十分优秀!