dlt.loadSubPackage
Introduction
Download subpackage resources.
Usage Restrictions
Supported from Core Library version 7.2.0
and above.
Parameters
Object object
Property | Type | Default | Required | Description |
---|---|---|---|---|
root | String | Yes | The root of the subpackage that needs to be downloaded | |
success | Function | No | Callback function for a successful API call | |
fail | Function | No | Callback function for a failed API call | |
complete | Function | No | Callback function executed at the end of the API call (executed for both success and failure) |
object.success Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | true - Success |
object.fail Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | false - Failure |
Example Code
// pages/index/index.js
Page({
loadSubPackage() {
dlt.loadSubPackage({
root: 'packageA',
success: res => {
console.log('loadSubPackage success', res);
},
fail: err => {
console.log('loadSubPackage fail', err);
},
complete: res => {
console.log('loadSubPackage complete', res);
},
});
},
});