微信小程序wx.showActionSheet调用客服信息功能


微信小程序wx.showActionSheet调用客服消息功能

官方文档的代码:

wx.showActionSheet({
  itemList: ['A', 'B', 'C'],
  success (res) {
    console.log(res.tapIndex)
  },
  fail (res) {
    console.log(res.errMsg)
  }
})

但是客服消息功能调用,没有api。只有按钮。

<button open-type="contact"></button>

引用之前移除的组件action-sheet,好像也能用。。。

wxml

<view bindchange="test">显示</view>
<action-sheet  hidden="{{actionSheetHidden}}" bindchange="test" >
   <action-sheet-item bindtap='makephone'>电话咨询</action-sheet-item>
   <action-sheet-item>
         <button open-type="contact">微信咨询</button>
   </action-sheet-item>
   <action-sheet-cancel>取消</action-sheet-cancel>
</action-sheet>

js

Page({
  data: {
    actionSheetHidden: true
    },
  test: function () {
    this.setData({
      actionSheetHidden: !this.data.actionSheetHidden,
    })
  },
  makephone: function() {
    wx.makePhoneCall({
      phoneNumber: '1300'
    })
  }
})

ps:不要随便设置button的样式,可能会出现bug。。。(如果有其他方法,请评论一下,谢谢)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM