HomeDocs
Skip to main content

Preview Image

Preview images in full-screen mode in a new page. During the preview, users can save and share the images.

methodName: previewImage​

Additional Parameters:​

PropertyTypeRequiredDefaultDescription
urlsString[]YesList of image URLs to preview.
showmenuBooleanNofalseWhether to display the save and share menu.
currentNumberNoThe index of the image to display (starting from 1).

Success Callback Function​

Parameters​

Object res​

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure.

Fail Callback Function​

Parameters​

Object res​

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure.
errMsgStringError message.
errMsg enumeration:
- Failed to preview image, parameter error: PI001
- Failed to preview image, no permission: PI002
- Failed to preview image, unknown error: PI003
- Failed to preview image, URL is not a valid URL: PI004

Example Usage​

const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();

if (canCallDlt) {
dlt.callApi('previewImage', {
urls: JSON.stringify(['xxx.png', 'yyy.png']),
showmenu: true,
current: 1,
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}
Privacy agreementDeveloper agreementcontact us: developer_private.mi@dlightek.com © 2024 MiniApp. All Rights Reserved.