uniapp 微信小程序如何实现多个item列表的分享

以下代码是某个循环里面的item

html 复制代码
		<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,请注意,会自动全部转成小写。

html 复制代码
<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里面能找到传递的参数

相关推荐
demo007x9 小时前
如何提高 AI 做小程序的效率?
微信小程序·ai编程·claude
2601_9520137610 小时前
新麦同城到家预约上门小程序V3全开源版 vueadmin+unipp开源前端+小程序端
小程序
土土哥V_araolin12 小时前
双迪大健康模式系统开发
小程序·个人开发·零售
2501_9160074712 小时前
HTTPS 抓包的流程,代理抓包、设备数据线直连抓包、TCP 数据分析
网络协议·tcp/ip·ios·小程序·https·uni-app·iphone
css在哪里14 小时前
小程序版 Three.js 入门 Demo(完整可运行)
3d·小程序·threejs
游戏开发爱好者814 小时前
React Native iOS 代码如何加密,JS 打包 和 IPA 混淆
android·javascript·react native·ios·小程序·uni-app·iphone
CHU72903515 小时前
社区生鲜买菜小程序前端功能版块设计及玩法介绍
前端·小程序
2501_9159184115 小时前
iOS mobileprovision 描述文件管理,新建、下载和内容查看
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张15 小时前
iOS 应用程序使用历史记录和耗能记录怎么查?
android·ios·小程序·https·uni-app·iphone·webview
学亮编程手记16 小时前
Mars-Admin 基于Spring Boot 3 + Vue 3 + UniApp的企业级管理系统
vue.js·spring boot·uni-app