进入首页 首页的轮播图6张 是从数据库里面读取地址加载出来的 打开时候需要加载很久 请问有什么方法吗 排除懒加载 图片已经进行过压缩
黄舟2017-05-16 13:01:36
If possible, use webp or tinyPNG for pictures;
Size to match the actual size of the carousel component, or create another thumbnail;
CDN;
http/1.x upgraded to http/2;
Cache to localStorage, the format is base64, set an expiration reload mechanism;
...
I’ll add more when I think of it
阿神2017-05-16 13:01:36
Simple, fast and threshold-free method:
Configure gzip compression on the server yourself
Spend some money to get a small file storage + CDN to serve together, such as Qiniu, OSS, Youpai...
More complicated, a bit threshold, and it depends on whether it is suitable for the specific application scenario:
Consider using Zhihu’s similar lazy loading effect, but it is much better than the traditional lazy loading experience, full of style, split the size of the image according to logic (or use the api of the cdn service to change the parameters), the default loading is small image, and then load the large image with the transition effect.
Please see this link for the effect: https://zhuanlan.zhihu.com/p/...
Small picture: https://pic2.zhimg.com/v2-bf1...
Large picture: https:// pic2.zhimg.com/v2-bf1...
Consider new image formats, such as Google's webp. Lossy compression is estimated to be about 30% smaller than jpg, and lossless compression is estimated to be about 60% smaller than jpg. There is also Tencent's latest self-developed format TPG, which I have introduced in the past two days. Flying all over the sky