admin 管理员组

文章数量: 887007

城市列表(3)点击切换定位城市

 // 切换城市changeCity({label,value}){if(HOUSE_CITY.indexOf(label)>-1){localStorage.setItem('hkzf_city',JSON.stringify({label,value}))this.props.history.go(-1)}else{Toast.info('暂无该城市房源', 1);}}
// 渲染每一行数据的渲染函数  函数的返回值就是渲染在页面的每一行内容rowRenderer=({key, // Unique key within array of rowsindex, // Index of row within collectionisScrolling, // The List is currently being scrolledisVisible, // This row is visible within the List (eg it is not an overscanned row)style, // Style object to be applied to row (to position it)})=> {const { cityIndex,cityList } = this.stateconst letter = cityIndex[index]return (<div key={key} style={style} className="city" ><div className="title">{formatCityIndex(letter)}</div>{cityList[letter].map((item=><div className="name" key={item.value} onClick={()=>this.changeCity(item)}>{item.label}</div>))}</div>)}

本文标签: 城市列表(3)点击切换定位城市