Taro.previewImage(option)
Previews the image in full screen on a new page. You can save or send it to others while preview.
Type
(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
Taro.previewImage({
current: '', // The http link of the current image
urls: [] // The http links of the images to preview
})
API Support
| API | WeChat Mini-Program | Baidu Smart-Program | Alipay Mini-Program | H5 | React Native |
|---|---|---|---|---|---|
| Taro.previewImage | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |