效果:
const App = props => { let alerts = () => { props.alertSs(props.time) } let is = {color:props.color? "red" : "blue"} return <div onClick={alerts} style={is}>{props.time},</div>; } let Apps = ()=>{ let alertSs = (time) => { alert(time) } return <div> {arrTime.map(item => <App alertSs={alertSs} key={item.time} time={item.time} color={item.color} />)} </div> }
原文地址:https://www.cnblogs.com/js-liqian/p/11747700.html
时间: 2024-10-09 20:04:50