HomeDocs
Skip to main content

dlt.addToHomeScreen

Introduction

Add a shortcut for the mini-program to the home screen.

Usage Limitations

Supported in the basic library version 4.0.0 or higher.

Parameters

Object object

PropertyTypeDefaultRequiredDescription
successfunctionNoCallback function for a successful API call.
failfunctionNoCallback function for a failed API call.
completefunctionNoCallback function for the completion of the API call (executed whether the call is successful or not).

object.success Callback Function

Parameters

Object res

PropertyTypeDescription
successstringtrue - Setting successful.

object.fail Callback Function

Parameters

Object res

PropertyTypeDescription
successstringfalse - Setting failed.

Sample Code

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