以下代码可用于在微信小程序中的客服咨询与用户分享操作。按钮通过设置 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%;
}
样式二,无图片有文字
.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;
}
标签:bottom,悬浮,微信,按钮,80rpx,plain,border,view
From: https://blog.csdn.net/qq_21171735/article/details/143330870