carolinezhao / eventdeer

Publish (web) and View (miniprogram) Schedule.
MIT License
0 stars 0 forks source link

code review #1

Open bernielxy opened 6 years ago

bernielxy commented 6 years ago

https://github.com/carolinezhao/eventdeer/blob/26e8899c53970006bd1f92bc9ccfca090e07a08c/miniprogram/pages/index/index.js#L55

提取成一个 外部方法。

https://github.com/carolinezhao/eventdeer/blob/26e8899c53970006bd1f92bc9ccfca090e07a08c/miniprogram/pages/index/index.js#L63

将 query1 替换为有意义的变量名

https://github.com/carolinezhao/eventdeer/blob/26e8899c53970006bd1f92bc9ccfca090e07a08c/miniprogram/pages/index/index.js#L77

可以参考 https://stackoverflow.com/a/40774906/7905162 进行优化

https://github.com/carolinezhao/eventdeer/blob/26e8899c53970006bd1f92bc9ccfca090e07a08c/miniprogram/pages/index/index.js#L127

尝试 map

https://github.com/carolinezhao/eventdeer/blob/26e8899c53970006bd1f92bc9ccfca090e07a08c/miniprogram/pages/index/index.js#L166

可以在 case 里再声明 startTime

carolinezhao commented 6 years ago

Notes

关于变量

关于 switch

关于数组迭代