1. The mini program comes with native sharing to the circle of friends
onShareAppMessage: function () {
console.log('转发');
},
1.1button share button
<button class="invitebtn" open-type="share">立即邀请</button>
1.2 Click the button button to share to get the invitation code
onShareAppMessage: async function(res) {
console.log(res);
if(res.from == "button"){
let result = await Api.createcode();
if(result.data.code == 200){
this.code = result.data.data.inviteCode
console.log(this.code);
}
console.log(this.code);
}
return {
path: '/pages/home/init?inviteCode='+this.code
}
},
2. Hide native sharing
onLoad(){
uni.hideShareMenu()
}
3. Native sharing to Moments
onShareTimeline() {
},