微信小程序开发:微信小程序实现拨打电话、手机和小程序客服_百业营销网

微信小程序开发:微信小程序实现拨打电话、手机和小程序客服

微信小程序开发 157℃ 0

微信小程序开发:微信小程序实现拨打电话、手机和小程序客服



平时我们在微信小程序开发时,免不了都需要:电话,手机,客服等常见联系方式功能,所以今天直接放微信小程序开发代码:


1、在wxml中写入:
<view class="popuptel" bindtap='tels'>拨打电话:0755-32926666</view>
<view class="popuptel" bindtap='phone'>拨打手机:15817498888</view>
<button class="popupkefu" open-type="contact"><text>在线客服咨询</text></button>

2、在js中写入:
 //拨打电话事件
tels:function () {
  wx.makePhoneCall({
    phoneNumber: '0755-32926666',//在这里填写正确的电话
    success:function(){
      console.log('拨打成功')
    },
    fail:function(){
      console.log('拨打失败')
    }
  })
},
//拨打手机事件
phone:function () {
  wx.makePhoneCall({
    phoneNumber: '15817498888',//在这里填写正确的手机号
    success:function(){
      console.log('拨打成功')
    },
    fail:function(){
      console.log('拨打失败')
    }
  })
},

3、保存提交,即可简单的实现了日常微信小程序中需要的联系功能。

本文由百业营销网原创,转载请注明版权和链接。