# image
Start from base library version 1.0.0. Please remaining backward compatible.
WeChat Windows edition: Support
WeChat Mac edition: Support
# Functional description
Picture. Support JPG、PNG、SVG、WEBP、GIF Etc., 2.3.0 Support for cloud file IDs.
# Property Dxplaination
Skyline List only the connection with the WebView The difference between the attributes that are not listed and the WebView Consistent.
| attribute | type | Default value | Required | Introductions | Minimum version | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| src | string | no | Photo Resource Address | 1.0.0 | |||||||||||||||||||||||||||||||||||||||||||||||
| mode | string | scaleToFill | no | Image cropping, scaling mode | 1.0.0 | ||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| webp | boolean | false | no | Default does not parse webP Format, only supports network resources | 2.9.0 | ||||||||||||||||||||||||||||||||||||||||||||||
| lazy-load | boolean | false | no | The picture is lazy to load, and it starts to load when it is about to enter a certain range (up and down three screens) | 1.5.0 | ||||||||||||||||||||||||||||||||||||||||||||||
| show-menu-by-longpress | boolean | false | no | Long press picture display to send to a friend, collection, save pictures, search a search, open business cards/Go to Group Chat/Open the menu of the Mini Program (if the image contains the corresponding QR code or Mini Program code). | 2.7.0 | ||||||||||||||||||||||||||||||||||||||||||||||
| binderror | eventhandle | no | Triggered when an error occurs, event.detail = {errMsg} | 1.0.0 | |||||||||||||||||||||||||||||||||||||||||||||||
| bindload | eventhandle | no | Triggers when the picture is finished loading, event.detail = {height, width} | 1.0.0 | |||||||||||||||||||||||||||||||||||||||||||||||
Component differences
1. use svg Format and mode=scaleToFill When, WebView Will be centered (unless svg Riga preserveAspectRatio="none"),Skyline Will fill up
2. svg Format does not support percentage units
3. svg Format not supported <style> element
1. use svg Format and mode=scaleToFill When, WebView Will be centered (unless svg Riga preserveAspectRatio="none"),Skyline Will fill up
2. svg Format does not support percentage units
3. svg Format not supported <style> element
| attribute | type | Default value | Required | Introductions | |
|---|---|---|---|---|---|
| fade-in | boolean | false | no | Whether to fade | |
| mode | string | scaleToFill | no | Only support scaleToFill / aspectFit / aspectFill / widthFix / Height Fix, the rest not yet supported, shown as centered | |
| webp | boolean | false | no | No need to specify, default support | |
| lazy-load | boolean | false | no | suffer scroll-view Render impact on demand, effective by default |
# Support long press identification code
| type | Introductions | Minimum version |
|---|---|---|
| Mini Program code | ||
| WeChat Personal Code | 2.18.0 | |
| WeCom Personal Code | 2.18.0 | |
| Ordinary group code | Refers to the group that contains only WeChat users | 2.18.0 |
| Interworking group code | Refers to a group that has both WeChat users and WeCom users | 2.18.0 |
| Official Account message template two-dimensional barcode | 2.18.0 |
# Bug & Tip
tip: image component default width 320px, height 240pxtip: When the image component is scaled, the calculated width and height may have decimals, and the decimals may be erased from rendering under different webview kernels
# sample code
# Original drawing
