javascript - material-ui react.js 中带有评级值的错误
问题描述
我有 3 组不同的评级,它们都需要独立。该错误是当单击其中一个评级时,只有第一组(首先呈现)评级发生变化。这意味着所有不同的评级集之间似乎存在联系。
与此错误有关的主要部分是名为 AssetName 的方法。
function AssetName(props) {
let localAssetName = [];
let streamHolder = [];
let holder = [];
localAssetName.push("Asset 1");
localAssetName.push("Asset 2");
localAssetName.push("Asset 3");
localAssetName.push("Asset 4");
localAssetName.push("Asset 5");
localAssetName.push("Asset 6");
// this.setState({ assetNameAr : localAssetName});
// this.setState({assetTest: true})
props.parentCallback(localAssetName);
let displasset = function displfcn() {
for (let i1 = 0; i1 < localAssetName.length; i1++) {
holder.push(
<Grid container spacing={10}>
<Grid item>
<Box> {localAssetName[i1]}</Box>
</Grid>
<Grid item p={10} ml={10}>
{/* Technical Expertise */}
{/* <AssetLoop len ='1'/> */}
<Rating max={3}> </Rating>
</Grid>
<Grid item p={10} ml={10}>
{/* Business Knowledge */}
{/* <AssetLoopBN len ='1'/> */}
<Rating max={3}> </Rating>
</Grid>
<Grid item>
{/* How recently have you worked on this asset? */}
{/* <AssetLoopREC len = '1'/> */}
<Rating max={4}> </Rating>
</Grid>
</Grid>
);
}
};
displasset(localAssetName);
return holder;
}
解决方案
Rating 的“name”属性必须是唯一的。 Material ui 的 github 上的类似问题
推荐阅读
- python - Python Kafka 生产者无法写入主题
- ios - 委托从模态呈现的视图控制器传回数据
- node.js - Google App Engine - 使用相同的 app.yaml 部署不同的文件夹
- javascript - 如何使用Javascript按名称更改按钮背景颜色
- oracle - 不一致的数据类型:预期的 TIMESTAMP 得到了 NUMBER
- reactjs - 这条线的调度来自哪里?export const setAlert = (msg, alertType,timeout=5000) =>dispatch =>
- python - Python检查列表中的所有元素是否都是Nan
- solace - Solace Spring Cloud Stream Binder AMQP(S)
- javascript - Mongodb:在只有默认索引(_id)的集合上使用 min 函数
- python - 如何在 SSH 进入 Linux 服务器后安装 Python?