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

2023-02-20,,

微信小程序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。。。(如果有其他方法,请评论一下,谢谢)

微信小程序wx.showActionSheet调用客服信息功能的相关教程结束。

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

下载本文的Word格式文档,以方便收藏与打印。