jus*_*dvl 4 typescript material-ui
我想在主题中自定义我的 DataGridPro 表(MUI 组件)。但是,当我 MuiDataGrid 到组件对象时,我收到 TS 错误:
Object literal may only specify known properties, and 'MuiDataGrid' does not exist in type 'Components'.ts(2322)
Run Code Online (Sandbox Code Playgroud)
Codesandbox: https://codesandbox.io/s/datagriddemo-material-demo-forked-vedcm
我该如何修复该错误?我花了2个小时四处寻找但没有成功。
jus*_*dvl 14
我在 MUI github 问题页面上得到了这个问题的答案:https://github.com/mui-org/material-ui-x/issues/1755#issuecomment-945650984
解决方案是像这样导入主题增强:
import type {} from '@mui/x-data-grid-pro/themeAugmentation';
Run Code Online (Sandbox Code Playgroud)
如所述: https: //mui.com/components/data-grid/getting-started/#typescript
| 归档时间: |
|
| 查看次数: |
3089 次 |
| 最近记录: |