Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize picture preloading on Mini Program

Shulou Source: shulou.com Published: 2022-06-01 05:45:12 09月30日 Update

This article mainly shows you "how Mini Program achieves picture preloading". The content is simple and clear. I hope it can help you solve your doubts. Now let the editor lead you to study and learn how Mini Program achieves picture preloading.

The page has page preloading, Mini Program also has picture preloading, Mini Program picture loading speed determines the user's residence time, then Mini Program picture preloading how to achieve?

In WeChat Mini Programs, to display a picture, there are two ways to load the picture:

First, load local pictures

Src= "/ image/arrowright.png" is used to load local image resources.

Second, load network pictures

Wechat is well encapsulated in loading the network, including the loading of voice and video. Directly append an address to the attribute 'src', and it will load automatically.

This imageUrl is the data in the js file

Data: {

ImageUrl: "http://img1.3lian.com/2015/w7/85/d/101.jpg"

}

It can also be written directly as

Change the loading picture in the response method of the button

DownImage:function (event) {

Console.log (event)

Var that = this

This.setData ({imageUrl: "another url"

})

}

These are all the contents of the article "how to preload pictures on Mini Program". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Pictures programs content articles web learning help picture resources addresses that is attributes buttons data files methods methods time easy to understand is in more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi vpn macOS NVidia