title: Taro.previewImage(option)

sidebar_label: previewImage

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

Reference

Type

  1. (option: Option) => Promise<CallbackResult>

Parameters

Option

Property Type Required Description
urls string[] Yes The URLs of images to preview.
current string No The URL of the current image
complete (res: any) => void No The callback function used when the API call completed (always executed whether the call succeeds or fails)
fail (res: any) => void No The callback function for a failed API call
success (res: Result) => void No The callback function for a successful API call

Sample Code

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

API Support

API WeChat Mini-Program Baidu Smart-Program Alipay Mini-Program H5 React Native
Taro.previewImage ✔️ ✔️ ✔️ ✔️ ✔️