摘要: 可配合vscode和px2rem插件使用 阅读全文
posted @ 2019-10-13 15:05 绿谷 阅读(127) 评论(0) 推荐(0) 编辑
摘要: <div class="cart" v-show="cart"> <div class="cart-content"> <img :src="imgUrl" /> </div> </div> //显示并切换卡片内容showcart(i) { //解决不了问题 //this.imgUrl = ''; 阅读全文
posted @ 2019-10-13 14:45 绿谷 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 1. 一张卡片切换内容(只有一张卡片,显示不同内容) 优点:减少代码量 缺点:内容涉及图片时,更改src会重新加载图片,即使两次显示同样的内容,图片依然会重新加载,体验性不好 2. 多张卡片固定内容(卡片内容固定,显示不同卡片) 优点:不用每次都加载图片,初始渲染就写入浏览器缓存中,配合图片预加载效 阅读全文
posted @ 2019-10-13 14:34 绿谷 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 1. 设置默认值 2. 图片懒加载 3. 骨架屏占位 阅读全文
posted @ 2019-10-13 14:24 绿谷 阅读(285) 评论(0) 推荐(0) 编辑
摘要: function load(url) { let imgObj = new Image(); // 创建图片对象 imgObj.src = url; if (imgObj.complete) { console.log('is loaded') } else { imgObj.onload = () => { console.log('loading success') }; imgObj.one 阅读全文
posted @ 2019-10-13 14:16 绿谷 阅读(526) 评论(0) 推荐(0) 编辑