From 71a538c700929307681a5b11e7a09d8d510cadcf Mon Sep 17 00:00:00 2001 From: lexiaoyao2 Date: Thu, 4 Sep 2025 17:39:29 +0800 Subject: [PATCH] placeholder for loading proces and fail Signed-off-by: lexiaoyao2 Change-Id: I688c9f2c36ef914cfe5bd5ae5363c151933054d9 --- api/@internal/component/ets/image.d.ts | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/api/@internal/component/ets/image.d.ts b/api/@internal/component/ets/image.d.ts index 43097a46f0..c00fc7aabe 100644 --- a/api/@internal/component/ets/image.d.ts +++ b/api/@internal/component/ets/image.d.ts @@ -1017,6 +1017,23 @@ declare class ImageAttribute extends CommonMethod { */ alt(value: string | Resource | PixelMap): ImageAttribute; + /** + * Sets the placeholder image displayed during loading. + * + *

NOTE: + *
This attribute does not take effect when the parameter type of the component is AnimatedDrawableDescriptor. + *

+ * + * @param { ResourceStr | PixelMap | ImageAlt } src - Placeholder image displayed during loading. + * @returns { ImageAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 22 + */ + alt(src: ResourceStr | PixelMap | ImageAlt): ImageAttribute; + /** * match Text Direction * @@ -2556,3 +2573,38 @@ declare interface ResizableOptions { */ lattice?: DrawingLattice; } +/** + * Set the placeholder image. + * + * @interface ImageAlt + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 22 + */ +declare interface ImageAlt { + /** + * Set the placeholder image during the loading process. + * + * @type { ?(ResourceStr | PixelMap) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 22 + */ + placeholder?: ResourceStr | PixelMap; + + /** + * Set the placeholder image when loading fails . + * + * @type { ?(ResourceStr | PixelMap) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 22 + */ + error?: ResourceStr | PixelMap; +} -- Gitee