JS
文章平均质量分 50
颗粒化
对待生命你不妨大胆一些,因为最终你都要失去它
展开
-
解决better-scroll在PC端使用,鼠标无法实现滚动的问题
在better-scroll的源码里面,有这样的一行代码; 接下来直接上代码: this.scroll = new BScroll(this.refs.scrollWrapper as Element, { scrollbar, probeType, click, scrollX, stopPropagation, eventPassthrough, pullDownRefresh: onFinishPullDown ? { threshold: 50,原创 2021-04-08 17:34:40 · 1302 阅读 · 1 评论 -
数组降维,过滤,累加的实现
使用场景: reduce() 是一个有用的函数式编程技术,像是一般的累加,数组降维以及统计数组种出现的次数等等都可以通过该方法来实现; 接受参数: 1. Accumulator (acc) (累计器) 2. Current Value (cur) (当前值) 3. Current Index (idx) (当前索引) 4. Source Array (src) (源数组) 返回值: accumulator 累计器 currentValue 当前值 currentIndex 当前索引 array 数组 为原创 2021-04-07 09:40:30 · 172 阅读 · 0 评论