javascript - (Material-ui/React) Prop 类型失败 : Invalid prop `cellHeight` supplied to `GridList`

标签 javascript reactjs material-ui

warning.js:33 Warning: Failed prop type: Invalid prop cellHeight supplied to GridList.

我收到此错误,但该属性有效。无论如何要摆脱这个?

这是来自 material-ui 的网格列表文档: http://www.material-ui.com/#/components/grid-list

cellHeight: 180(默认)

在我的代码中的使用:

<div className="images-tile">
  <GridList cols={4} cellHeight="120">
    {generateTiles(imagesArray)}
  </GridList>
</div>

视觉上(有效)

enter image description here

但是得到这个错误

enter image description here

最佳答案

Material UI 的 Gridlist 组件采用数字作为 cellHeight

所以你应该能够做这样的事情:

<div className="images-tile">
  <GridList cols={4} cellHeight={120}>
      {generateTiles(imagesArray)}
  </GridList>
</div>

关于javascript - (Material-ui/React) Prop 类型失败 : Invalid prop `cellHeight` supplied to `GridList` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48812626/

相关文章:

reactjs - Material ui SelectField如何更改菜单的宽度

javascript - 如果在 handle 栏中进行相等检查

javascript - 在 Node.js 的 require 声明中不使用 var 会产生什么后果?

javascript - 将变量从函数传递到 React return() 函数

reactjs - 在 ReactJS 中创建动态目录

javascript - 如何在Material-UI表格中显示动态数据?

javascript - 我可以在 javascript 中不使用循环的情况下重复对象数组中的值 n 次吗?

javascript - 我的喜欢/不喜欢系统没有按预期工作 php

reactjs - 如何在 React Native 中创建可拖动组件?

reactjs - react 钩子(Hook)形式 V7 : value is not cleared after unmounting its registered component