# go-where **Repository Path**: zhangweidong_gitee/go-where ## Basic Information - **Project Name**: go-where - **Description**: react-hooks重构去哪儿网 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-29 - **Last Updated**: 2021-11-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # React 新特性 Hooks 重构去哪儿网火车票 PWA 该项目利用 [React](https://reactjs.org)、[Redux](https://redux.js.org/)等技术重构去哪儿网火车票,重度使用 [Hooks](https://reactjs.org/docs/hooks-intro.html) 重写视图组件。 ## 用法 ```sh npm start ``` #### 需要视频资源的可以私信我(免费分享) #### hooks 基本语法可参考 hkzf 项目 src/demo 文件夹 ### 主要技术 `react、hooks、redux/react-redux 、day.js、fetch、webpack多页面应用程序配置(entry、html简单配置) urijs` ### 需要掌握 ### redux 相关 ``` action bindActionCreator reducer combineReducers ``` ### react-dedux 相关的 ``` Provider/ Connect(高阶函数) createStore mapStateToProps mapDispatchToProps applyMidware 配合react-thunk 处理异步 ``` 使用到 js 方法 ``` Array.from() String.fromCharCode() //转成大写字母 +65 data-xxx="" 然后选择`[data-xxx=${aa}]` scrollIntoView() //视图跳转到可视区 document.documentElement.width //获取html的width window.getComputedStyle(ele) touchstart touchmove ``` ### 日历组件思路分析 - 获取当前月的数据,将当月数据设置成 1 号,让月份+1,添加到数据中 - 遍历月份数组 在月份组件获取 props 传递的当前月 1 号时间转成时间戳 copy 一份,while 循环中让当前每天日期+1,然后添加当前天数 days 数组 days 处理前后空格问题,concat 起来 - 处理月的数据 days 数据循环 除以 7 得到每一周的数据,遍历 weeks,渲染每一周的组件 - 遍历每一周数据 ,得到每天的时间,处理空数据的样式情况得到日历列表 ### urijs (http://medialize.github.io/URI.js/docs.html) ``` URI.parseQuery(string querystring) ``` lazy suspense