Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use lazy loading of v lazy pictures

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

How to install v lazy pictures lazy loading, I believe many inexperienced people are helpless about this, this article summarizes the causes and solutions of the problem, through this article I hope you can solve this problem.

vue is based on vue-lazyload image lazy loading, delayed loading vue-lazyload plug-in effect is the default does not load images.

vlazy pictures lazy loading plug-ins

npminstallvue-lazyload--save-dev

Introduced and used in the entry file main.js

importVueLazyloadfrom'vue-lazyload'

Vue.use(VueLazyload,{

loading:require ('img/loading.png '),//Loading images, must have, otherwise it will be loaded repeatedly

error:require ('img/error.png ')//load failed image

});

Change the image display mode to vlazy image lazy loading

img:

//Change the src attribute to v-lazy,:key is to prevent the image from updating when the page is refreshed or the image is changed

Background image:

v-html, as in a rich text string fetched from the background Picture: (replace src with data-src)

After reading the above content, do you know how to install v lazy pictures? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report