以下代码可用于在微信小程序中的客服咨询与用户分享操作。按钮通过设置 plain='true' 来使其显示为简单的图标按钮,按钮的位置和样式通过 CSS 进行了详细的定制,确保在不同屏幕大小和设备上都能良好显示和使用,以下为参考代码。
代码实现
样式一,无文字有图片
<button plain='true' open-type="contact" class="contact">
<image mode='aspectFill' src='../../images/my/kefuwechat.png' class='cs-image'></image>
</button>
<button plain='true' open-type="share" class="share">
<image mode='aspectFill' src='../../images/my/share.png' class='cs-image'></image>
</button>
.cs-image {
width: 80rpx;
height: 80rpx;
}
.contact[plain],
.share[plain] {
display: flex;
margin-right: 20rpx;
right: 0;
position: fixed;
padding: 0;
border: none;
width: 80rpx;
height: 80rpx;
}
.contact[plain] {
bottom: 18%;
}
.share[plain] {
bottom: 10%;
}
样式二,无图片有文字
<button open-type="contact" class="bt-view" hoverClass="btn-hover"> <text class="text-df margin-left-xs">客服管理</text></button>
<button open-type="share" class="bt2-view" hoverClass="btn-hover"> <text class="text-df margin-left-xs">分享朋友</text></button>
.bt-view,
.bt2-view {
align-items: center;
background: #1c91ff;
border: 1rpx solid #96969686;
border-bottom-left-radius: 500rpx;
border-top-left-radius: 500rpx;
box-shadow: 0 5rpx 20rpx rgba(34, 34, 34, .5);
color: #fff;
display: flex;
filter: drop-shadow(rgba(102, 102, 102, .2) 5px 5px 11px);
font-weight: 700;
height: 70rpx !important;
letter-spacing: 2rpx;
padding: 10rpx 5rpx 10rpx 20rpx;
position: fixed;
right: 0rpx;
z-index: 999;
}
.bt-view {
bottom: 230rpx;
}
.bt2-view {
bottom: 130rpx;
}
更多推荐内容
- AudioRelay 0.27.5 手机充当电脑音响 11 天前
- AIGC指令进阶课:AI思维培养与高效生活应用 13 天前
- DeepSeek全栈开发实战:AI应用落地全链路指南 13 天前
- 花生十三 2025网课资料全套合集 13 天前
- 网易云音乐小灯泡抽SVIP会员 14 天前
- Google外贸客户开发实战是一本非常实用的快速入门指南。 18 天前
- 星辰八字教程:基础到进阶全解析 21 天前
- AI办公与副业创收实战指南 21 天前
- 正统道学精要:百年集成50册 21 天前
- 配方技术分享-粽子配方多套 22 天前

文章采用: 《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权。
版权声明:本站资源来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系客服并出示版权证明以便删除!
PHP怎么实现微信小程序内容安全识别接口?
« 上一篇
07-13
情侣小窝 Like_Girl源码V5.1.1
下一篇 »
07-13