【微信小程序-原生开发】客服

效果预览

在这里插入图片描述

在这里插入图片描述

实现方案

  1. 需先在小程序后台添加客服

在这里插入图片描述

  1. 在小程序中添加客户按钮
    <button open-type='contact' class='contactButton'>
      <t-grid-item style="width: 100%;" text="客服" icon="service" />
    </button>
  • button 组件上,添加 open-type='contact' 即可打开微信客服会话
  • 此处将要显示的内容放在 button 组件内
.contactButton {
    
    
  display: inline-block;
  width: 25%;
  background-color: transparent;
  padding: 0;
  margin: 0;
  font-size: inherit;
}

.contactButton::after {
    
    
  border: none
}
  • 修改button 组件的样式,来隐藏原生按钮
  • 根据页面的需求,修改对应的 width 值

猜你喜欢

转载自blog.csdn.net/weixin_41192489/article/details/129964508