Front-end/react/项目/13.租房小组.md

849 B

  1. state中添加租房小组数据group
  2. 新建一个方法getGroups用来获取数据,并更新groups状态
  3. 在componentDidMount钩子函数中调用该方法
  4. 使用过去到的数据渲染租房小组数据

H5中的地理位置API

navigator.geolocation.getCurrentPosition(position=>{
    console.log("当前位置信息",position)
})

懒渲染 可视区域渲染,大列表

react-virtualized

  1. 将获取到的cityList和cityIndex添加为组件的状态数据
  2. 修改List组件的rowCount为cityIndex的长度
  3. 将rowRender函数添加到组件内部,以便在函数中获取到状态数据cityList和cityIndex
  4. 修改List组件的RowRender为组件中的rowRender方法
  5. 修改rowRender方法中渲染的每行格式结构和样式.
  6. 修改list组件的rowHeight为函数,动态计算每一行的高度