Image
Introduction
The image component is a user interface (UI) element that displays image content. It supports image previews and lets you set the image source and related styles.

Configuration items
Category |
Configuration |
Example |
Description |
Content |
Image source |
The three modes for image resources. |
|
URL |
|
This takes effect when the image source is set to URL. The value is the link to the image. |
|
System file |
This takes effect when the image source is set to System file. The value is the image link. Select an image from the built-in resource files, or click the box below to upload a new one. |
||
Memory object |
|
This takes effect when the image source is set to Memory object. It can be associated with an upload component. For example: |
|
Hotspot configuration |
Define specific areas on an image. Clicks in these areas trigger interactive behaviors and enhance the user experience. |
||
Image description |
The text to display when the image fails to load. |
||
Fallback address on load failure |
|
Displays a preset image placeholder when the image fails to load. |
|
Progressive load |
Enable Progressive load to improve user experience and avoid long waits for large images. It first shows a simplified preview, such as a low-resolution image, a solid color background, or a Low Quality Image Placeholder (LQIP). This optimizes the visual experience before the full image finishes loading. |
||
Allow preview |
Lets users click the image to open a pop-up and view a high-definition preview. |
||
Preview configuration |
Redefine the path for the preview image. The default is the current image resource. |
||
Interaction |
Hidden |
Controls the default display state of the image component. When set to |
|
Style |
Height |
The height of the component. For more information, see Common properties |
|
Margin |
For more information, see Common properties |
||
Padding |
Specifies how the image content should fit into the box defined by its height and width. For more information, see the object-fit property
|
||
Image layout |
Specifies the position of the image within the component when the fit mode is set to contain. |
||
CSS style |
Border radius |
The border radius of the image component. For more information, see Common properties |
|
Flip |
|
The flip mode for the image. Supports horizontal and vertical flipping. The rotation point is the centroid of the image. For more information, see the rotate property |
Properties and methods
Name |
Type |
Example |
Description |
mode |
string |
|
The image source. |
src |
string |
|
The link of the current image component. |
file |
object |
|
Read-only. The image file resource. |
srcFile |
object |
|
Read-only. The image memory object. |
fallback |
string |
|
Read-only. Displays a preset image placeholder when the image fails to load. |
placeholder |
string |
|
Read-only. The link to the image for progressive loading. |
alt |
string |
|
Read-only. The text to display when the image fails to load. |
preview |
boolean |
|
Read-only. Specifies whether the image can be clicked for a preview. |
hotAreas |
object |
|
Read-only. The hotspot configuration information for the image. |
hidden |
boolean |
|
Specifies whether the current component is hidden. For more information, see Common properties |
setSrc |
func |
|
Sets the image link to |
clearSrc |
func |
|
Clears the image link. |
setHidden |
func |
|
Sets whether the image is hidden. The parameter can be |
clearHidden |
func |
|
Clears the hidden state of the image. For more information, see Common properties |
Event callbacks
Configuration |
Description |
The event that is triggered when the image is clicked. |
|
The event that is triggered when the image fails to load. |
Scenario example
Product image display scenario
The product image is displayed in the area on the left.





