摘要: 懒加载列表 虚拟列表:一次性获取全部数据,但是只显示一部分 只渲染start和end之间的数据,使用translate3d实现在y轴滚动的效果。 终极目标 求出在可视区域显示的数据 求出滚动列表在y轴的偏移量 计算需要的变量 itemHeight: 单个元素的高度 visbleCount: 可显示的 阅读全文
posted @ 2022-10-30 20:38 pocoui 阅读(61) 评论(0) 推荐(0)
摘要: intersecton Observer 检测dom的位置 Element.getBoundingClientRect() 方法返回一个 DOMRect 对象,其提供了元素的大小及其相对于视口的位置。 阅读全文
posted @ 2022-10-30 16:15 pocoui 阅读(34) 评论(0) 推荐(0)
摘要: cookie安全 secure https httpOnly 预防xss document.cookie × sameSite 预防csrf strict:cookie只发送给它的来源站点 lax:默认 cookieName前缀 _Host-(与secure属性一起设置,Https) _Secure 阅读全文
posted @ 2022-10-28 09:28 pocoui 阅读(14) 评论(0) 推荐(0)
摘要: 图解https 阅读全文
posted @ 2022-10-26 21:12 pocoui 阅读(20) 评论(0) 推荐(0)
摘要: 注意区分 节流(射击游戏)n秒内只执行一次 例:子弹发射小游戏,无论点击频率是多少,在一定的时间内只会发射1个子弹。 防抖(广告) n秒后执行 例:相当于看视频需要先看广告,如果刷新页面,那么就要重头开始看广告。 阅读全文
posted @ 2022-10-26 11:32 pocoui 阅读(19) 评论(0) 推荐(0)
摘要: class EventEmitter { // 补全代码 constructor(){ this.events = {} } on(eventName, callback){ //一个事件上注册多个回调函数 const callbacks = this.events[eventName] || [] 阅读全文
posted @ 2022-10-26 11:09 pocoui 阅读(22) 评论(0) 推荐(0)
摘要: .box5 { justify-content: space-between; } .box5 div { display: flex; flex-direction: column; justify-content: space-between; } 注意选择器的优先级 .box5 .center 阅读全文
posted @ 2022-10-25 10:04 pocoui 阅读(36) 评论(0) 推荐(0)
摘要: 通过split将字符串分割成数组 -font-size //['', 'font', 'size'] font-size //['font', 'size'] function cssStyle2DomStyle(sName) { var arr = sName.split('-').filter( 阅读全文
posted @ 2022-10-25 09:34 pocoui 阅读(17) 评论(0) 推荐(0)
摘要: 声明式的UI框架 javascript对象和模板都可以声明式地描述UI 虚拟dom就是用js对象来描述真实的DOM结构。 渲染器 将虚拟DOM渲染为真实DOM 可以精确地找到vnode对象的变更点 阅读全文
posted @ 2022-10-24 11:33 pocoui 阅读(20) 评论(0) 推荐(0)
摘要: 箭头函数 和声明式函数一样 let sum = function(a,b){ return a+b } let sum = (a,b)=>{ return a+b } 没有Prototype,不能成为构造函数,不能使用new 不能使用arguments 不能使用super 访问类的prototype 阅读全文
posted @ 2022-10-20 21:02 pocoui 阅读(16) 评论(0) 推荐(0)