dlt.getLaunchOptions
Introduction
Get the parameters when the mini-program is launched through a social sharing link.
Example Link: http://h5.dlight-app.com/outside?appId=100014&page=pages/feedDetail/feedDetail&query=a%3Daaa%26b%3Dbbb
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| 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 that is called when the API call is complete (whether successful or not) |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | true- Success |
| query | string | The query parameter of the current mini-program, parsed from the query field of the launch parameters. Note: If there are no launch parameters, the query parameter will be an empty string. |
| path | string | The page address of the current mini-program |
| scene | string | Currently, there is no launch scene, so it defaults to 100000 |
| referrerInfo | referrerInfo | Referral information |
Object referrerInfo
| Property | Type | Description |
|---|---|---|
| appId | string | The source mini-program |
| extraData | object | Data sent from the source mini-program |
Object extraData (Default)
| Property | Type | Description |
|---|---|---|
| query | string | The query parameter of the current mini-program, parsed from the query field of the launch parameters. Note: If there are no launch parameters, the query parameter will be an empty string. |
| mode | string | Debug mode: DEBUG. Note: If there are no launch parameters, the mode parameter will be an empty string. |
| version | string | The version number of the mini-program dev version. If the mode is debug, the version number must be present. |
| page | string | The address of the specified mini-program from social sharing. Note: If there are no launch parameters, the page parameter will be an empty string. |
object.fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | false- Failure |
Example Code
// pages/index/index.js
Page({
getLaunchOptions() {
dlt.getLaunchOptions({
success: (res) => {
console.log('success', res);
},
});
},
});