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
Property | Type | Default | Required | Description |
---|---|---|---|---|
success | function | No | Callback function when the interface is successfully called | |
fail | function | No | Callback function when the interface call fails | |
complete | function | No | Callback function when the interface call ends (executed whether successful or failed) |
Return Value
Property | Type | Description |
---|---|---|
filePath | string | Returns 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);
},
});
},
});