This article mainly introduces detailed information about small program image loading (local, network) instances. For more information, see this article) for more information about instances, see
To display an image in a applet, there are two ways to load the image:
Load local images
Attach network Image
Load local images
Src = "/image/arrowright.png" is used to load local image resources. Think about loading a local image in iOS, imageName:, similar.
Attach network Image
It is encapsulated in terms of network loading, including audio and video loading. Directly attach an address to the 'src' property, which is automatically loaded.
This imageUrl is the data in the js file.
data:{ imageUrl:"http://img1.3lian.com/2015/w7/85/d/101.jpg" },
You can also directly write
Let's take a look at some attributes of the image.
downLoadImage:function(event){ console.log(event) var that = this; this.setData({ imageUrl:"http://h.hiphotos.baidu.com/zhidao/pic/item/6d81800a19d8bc3ed69473cb848ba61ea8d34516.jpg" }) }
The effect is as follows:
Thank you for reading this article. I hope it will help you. thank you for your support for this site!
The above is the details of the code of the instance for image loading (local, network) in mini-program development. For more information, see other related articles in the first PHP community!