uniapp方法二开发微信小程序实现分享链接给朋友

注意: 在微信 里面有两种分享 :

1、点击 按钮分享

2、微信小程序右上角自带分享功能

以下说的是 第一种做法 第二种做法在另外一篇文章

1、绑定

 // 按钮 绑定  ->     open-type="share"

<u-button type="info" color="transparent" class="custom-button" open-type="share">
	分享
			</u-button>

2、事件

可以携带一些参数 过去

	//左侧分享功能 
		onShareAppMessage(res) {
			let customerId = uni.getStorageSync('customerId'); 
			let userId = uni.getStorageSync('userId');   
			let sceneStr = '';
			let scene = {
				a: userId,//用户id
				b: customerId,//客户id
				d: this.activityType == 4 ? 5 : this.activityType, // 活动类型  如果传过来的值是 4 那么就传 5过去
				c: 1//c=海报类型1客户2员工
			};
			if (res.from === 'button') {	// 来自页面内分享按钮
				console.log(res.target);
			}
			return {
				title: '推荐有礼', //分享的名称
				path: '/pages/Login/index?scene=' + encodeURIComponent(JSON.stringify(scene)) + '&tiaozhuan=' + 1,
				mpId: 'wx363402ec173d7c4f' //微信小程序的AppId	
			};
		},

再另一个页面获取数据 


onLoad(data) {
let scene = JSON.parse(decodeURIComponent(data.scene));
}

可以看这篇文章

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值