Circular image

Updated at:

The circular image component is a UI element used to display images. It supports image previews and lets you set the image source and related styles.

image

Configuration items

Category

Configuration

Example

Description

Content

Image source

Three modes for the image resource.

URL

image

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. Select an image from the built-in resource files or click the selection box below to upload one directly.

Memory object

image

This takes effect when the image source is set to Memory object. It can be used with an upload component. For example: upload1.values?.[0]. This is useful for scenarios where an actual upload is not required.

Hot area configuration

Lets you define specific areas on an image. Clicking these areas can trigger specific interactive behaviors to enhance the user experience.

Image description

The text to display when the image fails to load.

Fallback address on load failure

image

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 to load. It optimizes the visual experience by first showing a simplified preview, such as a low-resolution image, a solid color background, or a Low Quality Image Placeholder (LQIP), before the full image is loaded.

Allow preview

Lets users click the image to open a pop-up layer and view a high-definition preview.

Preview configuration

Redefine the preview image path. The default is the current image resource.

Interaction

Hide

Controls the default display state of the image component. When set to true, the component is hidden. For more information, see Common properties

Style

Height

The component height. 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

  • Cover: The image fills the entire content box of the element while maintaining its aspect ratio.

  • Contain: The image is scaled to fit within the content box while maintaining its aspect ratio.

  • Fill: The image is stretched to completely fill the component box. If the aspect ratio of the image does not match the component box, the image is stretched to fit.

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. You can create a circular image by making the image width and height equal and setting the border radius to 50%.

Flip

image

The flip mode for the image. Supports horizontal and vertical flipping. The pivot point is the centroid of the image. For more information, see the rotate property

Properties and methods

Name

Type

Example

Description

mode

string

circularImage1.mode

Image source.

src

string

circularImage1.src

The link of the current image component.

file

object

circularImage1.file

Read-only. The image file resource.

srcFile

object

circularImage1.srcFile

Read-only. The image memory object.

fallback

string

circularImage1.fallback

Read-only. Displays a preset image placeholder when the image fails to load.

placeholder

string

circularImage1.placeholder

Read-only. The link to the image for progressive loading.

alt

string

circularImage1.alt

Read-only. The text to display when the image fails to load.

preview

boolean

circularImage1.preview

Read-only. Specifies whether the image can be clicked for a preview.

hotAreas

object

circularImage1.hotAreas

Read-only. The hot area configuration information for the image.

hidden

boolean

circularImage1.hidden

Specifies whether the current component is hidden. For more information, see Common properties

setSrc

func

circularImage1.setSrc('Image Link')

Sets the image link to Image Link.

clearSrc

func

circularImage1.clearSrc()

Clears the image link.

setHidden

func

circularImage1.setHidden(false)

Sets whether the image is hidden. The parameter can be true or false. For more information, see Common properties

clearHidden

func

circularImage1.clearHidden()

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

  • Team member introduction scenario
    • On a corporate website or project page, photos of team members are often displayed as circles. This improves the overall aesthetics of the page and presents information more concisely.

      image