HomeDocs
Skip to main content

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

PropertyTypeDefaultRequiredDescription
urlsstring[]YesList of image URLs
showmenubooleanfalseNoWhether to show the save dialog (not implemented in this version)
currentnumber1NoIndex of the image to be displayed (starting from 1)
successfunctionNoCallback function for a successful API call
failfunctionNoCallback function for a failed API call
completefunctionNoCallback function that will be executed when the API call is complete (both successful and failed calls)

object.success Callback Function

Parameters

Object res

PropertyTypeDescription
successstringtrue - successful

object.fail Callback Function

Parameters

Object res

PropertyTypeDescription
successstringfalse - failed
errMsgstring1. 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);
},
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.