iShow:{
basicUser:true,
PersonneList:false
},
let arr=this.iShow
for (let item in arr) {
console.log(item,'属性名');
console.log(arr[item],'属性值');
arr[item] = false
}
```cpp
react 修改对象数据
class ContingencyPlan extends React.Component {
state = {
weather: [],
selected: 'emergencyPlan',
menu: <OrganizationalSystem />,
stationsData: [],
monitorsData: [],
backgroundColor : {
emergencyPlan: '#1099ff',
dataStatus: '',
emergencyIsolation: '',
diffusionSimulation: '',
monitoring: '',
summary: '',
},
};
for (let item in backgroundColor){
if(item==type){
this.setState(state => {
state.backgroundColor[item] = '#1099ff';
});
}else{
this.setState(state => {
state.backgroundColor[item] = '';
});
}
}