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里面能找到传递的参数

相关推荐
00后程序员张8 小时前
python 抓包在实际项目中的合理位置,结合代理抓包、设备侧抓包与数据流分析
android·ios·小程序·https·uni-app·iphone·webview
吴汉三12 小时前
iOS 和 HarmonyOS 兼容笔记
uni-app
apollo_qwe15 小时前
UniApp 请求封装实战:优雅实现 Token 无感刷新(附完整代码)
uni-app
2501_9159184115 小时前
使用 HBuilder 上架 iOS 应用时常见的问题与应对方式
android·ios·小程序·https·uni-app·iphone·webview
2501_9160074717 小时前
iOS 崩溃日志的分析方法,将崩溃日志与运行过程结合分析
android·ios·小程序·https·uni-app·iphone·webview
2501_9160074717 小时前
React Native 混淆在真项目中的方式,当 JS 和原生同时暴露
javascript·react native·react.js·ios·小程序·uni-app·iphone
00后程序员张18 小时前
苹果应用商店上架App流程,签名证书、IPA 校验、上传
android·ios·小程序·https·uni-app·iphone·webview
2501_9160074718 小时前
iOS 上架需要哪些准备,围绕证书、描述文件和上传方式等关键环节展开分析
android·ios·小程序·https·uni-app·iphone·webview
qq_124987075318 小时前
基于微信小程序的私房菜定制上门服务系统(源码+论文+部署+安装)
java·spring boot·微信小程序·小程序·毕业设计·毕设
2501_9151063218 小时前
iOS 上架费用解析,哪些成本可以通过流程优化降低。
android·ios·小程序·https·uni-app·iphone·webview