<View className="course">
{data.map((item, index) => {
return (
<View
className="courseList"
style={{
backgroundColor:
item.industryCode === codeCompare ? "#fff2e2" : ""
}}
onClick={() => this.handleSelected(item, index)}
>
<View className="textRideo">{item.industryName}</View>
</View>
);
})}
</View>
handleSelected = (val, index) => {
console.log(val, index);
this.setState({
codeCompare: val.industryCode
});
// this.props.handleSelect(val, index, i);
};
运行结果