dlt.sendToSms
Introduction
Send an SMS (Short Message Service).
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| phoneNumber | String | Yes | Phone number | |
| content | String | Yes | SMS content | |
| 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 |
object.fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | false- Failure |
Example Code
// pages/index/index.js
Page({
sendToSms() {
dlt.sendToSms({
phoneNumber: '131000xxxxxxxx',
content: 'hello world',
success: () => {
console.log('success');
},
});
},
});