有一個需求是分享當前頁面,使用美工的分享按鈕圖片來分享,而小程序分享功能只有button有
open-type="share"這個屬性,使用image標簽肯定不行。我是這樣做的:
<button open-type="share" style="height:85rpx;width:215rpx;padding:0;background-color:#fff;border-color:#fff;margin-right:10rpx" > <image style="height:85rpx;width:215rpx;" src='../../../image/share_btn.png'></image> </button>
加入css樣式去除button邊框
button::after{
border: none;
}
實際效果如下
這樣按鈕的邊框就消失了,單純的設置border:none和outline:none沒用。
小程序的分享事件
/** * 用戶點擊分享 */ onShareAppMessage: function () { return { title: '分享', desc: '活動描述', path: '/xxx/xxxx?id=' + this.data.id } },