### [怎们实现微信小程序拨号功能](https://www.prosaas.cn/article/16480) **Published:** 2020-12-30T08:44:33 **Author:** 5201314 **Excerpt:** 前言:由于我这里的点击事物是一种图片,因此我们需要先设置一个view,这里使用的是bindtap事件。(学习视… ![](https://img.php.cn/upload/article/202012/30/2020123016355629084.jpg) 前言: 由于我这里的点击事物是一种图片,因此我们需要先设置一个view,这里使用的是bindtap事件。 (学习视频分享:编程视频) 首先我们来看看官方文档是怎么说的: ![](https://img.php.cn/upload/image/876/233/735/1609317541871133.png) 我的demo的代码是这样的 index.wxml 然后调整一下ss,当然这只是我的demo的,实际应用还是看实际的。 index.wxss .tel{ display: block; width: 70rpx; height: 70rpx; position: absolute; margin-top:-100rpx; margin-left: 200rpx; } 直接去调用拨打电话 APIwx.makePhoneCall(OBJECT) 官方文档也写的很清楚 ![](https://img.php.cn/upload/image/997/177/571/1609317583101732.png) 主要是填写phoneNumber,其他看需求, 第一种方法是: index.js的Page里面去添加 tel:function () { wx.makePhoneCall({ phoneNumber: '158XXXXXXXX', }) } 还有一种是: 就是去全局量那里设置,去最外层的app.js的globalData添加一下 globalData: { userInfo: null, phoneNumber: '158XXXXXXXX' } 然后index.js添加的是 tel:function () { wx.makePhoneCall({ phoneNumber: app.globalData.phoneNumber, }) } 然后点击保存 ![](https://img.php.cn/upload/image/449/216/244/1609317667823764.png) 相关推荐:小程序开发教程 以上就是怎们实现微信小程序拨号功能的详细内容,更多请关注知企PROSAAS其它相关文章! **Categories:** 后端开发 ---