文档
- https://developers.weixin.qq.com/miniprogram/dev/component/button.html
打开客服会话
按钮关键属性
open-type="contact"
功能按钮
<button class="mo-open-type"open-type="contact">
</button>
分享
<button class="mo-open-type" open-type="share"></button>
css样式
父元素需要设置为相对定位,使用障眼法,将按钮元素隐藏,避免影响当前布局和样式
.mo-open-type {position: absolute;width: 100%;height: 100%;top: 0;left: 0;background-color: transparent;padding: 0;margin: 0;
}.mo-open-type::after {border: none;
}
或者
.mo-open-type {position: absolute;width: 100%;height: 100%;top: 0;left: 0;opacity: 0;
}