一、效果展示
点击联系客服, 调起微信客服功能, 需要和button组合使用
二、实现思路
1.客服只能通过button按钮调起, 所以我们需要写一个button按钮, open-type=“contact”, 然后设置id=“btnId”,再设置样式display: none把它隐藏起来。
2.给客服图标加一个label, 设置for=“btnId”, 这样点击图片就会触发button事件了。
三、完整代码
<view>
<button id="btnId" open-type="contact" bindcontact="handleContact" session-from="sessionFrom"style="display: none;"></button>
<label style=" width: 100%; display: flex;" for="btnId">
<image class="icon" src="../../static/images/mine/pic07.png">
<text style="flex: 1;">联系客服</text>
<image class="right" src="../../static/images/mine/Clipped.png">
</label>
</view>