import React from 'react' import './styles.less' export const PageView = () => { const [selectIndex, setSelectIndex] = React.useState(0) // 温控方式 // TODO:下面data这里为mock数据 const data = [ { id: 25462, img: 'https://img12.360buyimg.com/imagetools/jfs/t1/117476/18/6783/104442/5ebe43b9Ecc855a60/c990a0a57ca1a12f.png', }, { id: 25462, img: 'https://img12.360buyimg.com/imagetools/jfs/t1/117476/18/6783/104442/5ebe43b9Ecc855a60/c990a0a57ca1a12f.png', }, ] const selectedImg = (index) => { setSelectIndex(index) } return (
{data.map((child, index) => { return ( selectedImg(index)} className={ selectIndex === index ? 'item-choose item-default' : 'item-default' } src={child.img} /> ) })}
) }