微信小程序實現撥打電話功能


一、

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('成功撥打電話')
        }
    })
  },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM