微信小程序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