小程序分享 列表循环 携带参数
onShareAppMessage: function (ops) {
console.log(ops)
return {
title: ops.target.dataset.item.title,
imageUrl: ops.target.dataset.item.imageUrl,
path: `test?id=${ops.target.dataset.item.id}`
}
}
<button data-item="{{item}}" class="share-btn" open-type="share">
<image class="shareimg" src="../../imgs/share.png"></image>
<view class="sharetxt">分享</view>
</button>
.share-btn {
display: flex;
align-items: center;
margin: 0;
background-color: transparent;
}
button::after {
border: none;
}
.shareimg{
width: 38rpx;
height: 38rpx;
margin: 0 10rpx;
}
.sharetxt{
color: #323333;
font-size: 26rpx;
line-height: 1.65;
}