HomeDocs
Skip to main content

dlt.takeScreenshot

Introduction

This function captures a screenshot of the current page in the mini program, saves it to a file, and provides the file path.

Parameters

Object object

PropertyTypeDefaultRequiredDescription
successfunctionNoCallback function when the interface is successfully called
failfunctionNoCallback function when the interface call fails
completefunctionNoCallback function when the interface call ends (executed whether successful or failed)

Return Value

PropertyTypeDescription
filePathstringReturns the saved virtual address

Sample Code

// pages/index/index.js
Page({
takeScreenshot() {
dlt.takeScreenshot({
success: (res) => {
console.log('success', res);
},
fail: (res) => {
console.log('fail', res);
},
complete: (res) => {
console.log('complete', res);
},
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.