一、
wxml
<button catchtap="toCall">免费咨询</button>
wxjs
toCall:function(e){ wx.makePhoneCall({ phoneNumber: this.data.info.traininfo.phone, success: function () { console.log(\'成功拨打电话\') } }) },
二、
wxml
<view class="page_li sub" data-phone="{{shop.shopinfo.contact_phone}}" catchtap="tophone"> <image class="page_phone" src="/image/iocn.png" mode="aspectFill"></image> 打电话 </view>
wxjs
tophone: function(el) { let phone = el.currentTarget.dataset.phone; // console.log(phone) wx.makePhoneCall({ phoneNumber: phone, success: function() { console.log(\'成功拨打电话\') } }) },
请发表评论