dlt.previewImage
Introduction
Preview images in full screen in a new page. During the preview, users can save and share the images.
Parameters
Object object
| Property | Type | Default | Required | Description | 
|---|---|---|---|---|
| urls | string[] | Yes | List of image URLs | |
| showmenu | boolean | false | No | Whether to show the save dialog (not implemented in this version) | 
| current | number | 1 | No | Index of the image to be displayed (starting from 1) | 
| success | function | No | Callback function for a successful API call | |
| fail | function | No | Callback function for a failed API call | |
| complete | function | No | Callback function that will be executed when the API call is complete (both successful and failed calls) | 
object.success Callback Function
Parameters
Object res
| Property | Type | Description | 
|---|---|---|
| success | string | true - successful | 
object.fail Callback Function
Parameters
Object res
| Property | Type | Description | 
|---|---|---|
| success | string | false - failed | 
| errMsg | string | 1. Failed preview image, parameter error: PI001 2. Failed preview image, no permission: PI002 3. Failed preview image, unknownError: PI003 4. Failed preview image, url is not a valid URL: PI004  | 
Example Code
// pages/index/index.js
Page({
  previewImage() {
    dlt.previewImage({
      urls: ['xxx', 'xxx'],
      current: 1,
      success: (res) => {
        console.log(res);
      },
    });
  },
});