The one touch dialing function of Baidu applet needs to be coded in swan and js. The industrial monitoring station is taken as an example to illustrate how to use one touch dialing.
First bind the dialing function in swan, and then write the dialing function in the corresponding js. Note that the first contact number in the background set contact method is called in js. You need to fill in the phone number first, or you cannot dial.
Swan section:
![1562309688240676.png 0.png](/faq/uploads/images/20190705/1562309688240676.png)
Js section:
calling: function (e) {
let mobile = e.currentTarget.dataset.id;
if (!mobile) {
mobil = app.globaldata.settings.cfg_kefu_tel;
}
swan.makePhoneCall({
phoneNumber: mobile,
success: function () {
Console. log ("Call succeeded!")
},
fail: function () {
Console. log ("Call failed!")
}
})
}
![1562309788266044.png 0 (1).png](/faq/uploads/images/20190705/1562309788266044.png)
![1562309851198940.png 0.png](/faq/uploads/images/20190705/1562309851198940.png)
This article is written by Fuwei SEO Special Training Camp Edit and organize.
Search outside and focus SEO training And Saas service solutions around SEO. Over the past 10 years, more than 50000 students have gained technical improvement and contacts here.
SEO courses include mobile search, zero foundation station building, group station SEO thinking, Sowai 6 system, introduction to SEM, etc.
The registration time for Class B 190 is from May 15 to May 31. Please add enrollment customer service Xiaomo WeChat: seowy2021.
WeChat code scanning to add customer service personnel
Our goal is to make it easy for non-technical personnel to learn Internet technology.