以下代码是某个循环里面的item
<button class="cu-btn" style="background-color: transparent;padding: 0;"open-type="share" :data-tree="item.treeId" :data-project="item.projectId"v-if="typeId==1 && userInfo.isYourself"><view class="btn-2 f26 center c-theme">邀请助力</view></button>
温馨提示:如果:data-treeId="item.treeId" 这样写,到时候在接受的时候会变成treeid,请注意,会自动全部转成小写。
<script>
onShareAppMessage(res) {let dataset = res.target.dataset;console.log("开始分享", dataset);let shareobj = {path: `/v3/project/love-tree/tree?id=${dataset.tree}&projectId=${dataset.project}&share=1`,}console.log("path", shareobj);return shareobj;},onShareTimeline(res) {let dataset = res.target.dataset;let shareobj = {path: `/v3/project/love-tree/tree?id=${dataset.tree}&projectId=${dataset.project}&share=1`,}return shareobj;},
<script/>
温馨提示:如果需要带参数,data-后面加你声明的,例:data-id,在onShareAppMessage里面的res.target里面能找到传递的参数