Skip to main content
Version: 3.x

Taro.previewImage(option)

Previews the image in full screen on a new page. You can save or send it to others while preview.

Reference

Type

(option: Option) => Promise<CallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
urlsstring[]YesThe URLs of images to preview.
currentstringNoThe URL of the current image
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

Sample Code

Taro.previewImage({
current: '', // The http link of the current image
urls: [] // The http links of the images to preview
})

API Support

APIWeChat Mini-ProgramBaidu Smart-ProgramAlipay Mini-ProgramH5React Native
Taro.previewImage✔️✔️✔️✔️✔️