my.previewImage

The Preview image's "local image path" is not supported.

Supported types of mini programs: DSL, H5, H5+

Sample Code

copy
my.previewImage({
  urls: [
    'https://img.example.com/example1.jpg',
    'https://img.example.com/example2.jpg',
    'https://img.example.com/example3.jpg'
  ],
  success: (res) => {
    console.log('previewImage Success:', JSON.stringify(res, null, 2))
  },
  fail: (err) => {
    console.log('previewImage Failed:', JSON.stringify(err, null, 2))
  }
});

Parameters

The incoming parameter is of the Object type with the following attributes:

PropertyType

Required

Description
urlsArrayYesHttp url list of the images to be previewed.
currentNumberNoIndex of the current displayed image, 0 by default, indicating the first image in the URLs.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).