Create a WeChat applet with a blank template, only to find that it cannot be shared with friends and circle of friends after successful release
After checking, I found out that the sharing function needs to be turned on.
Add the following two functions to the home page of the applet
//用户点击右上角分享给好友,要现在分享到好友这个设置menu的两个参数,才可以实现分享到朋友圈
onShareAppMessage:function(){
wx.showShareMenu({
withShareTicket:true,
menu:['shareAppMessage','shareTimeline']
})
return {
title:'分享时标题',
imageUrl:''
}
},
//用户点击右上角分享朋友圈
onShareTimeline:function(){
return {
title:'分享时标题',
query:{
key:value
},
imageUrl:'分享时图片底图'
}
},
Share the picture basemap of the title to be displayed with friends and circles of friends.
return { title:'title when sharing', query:{ key:value }, imageUrl:'image basemap when sharing' }
Note: Wechat applets that use web-view pages cannot share Moments.
Then repost to share.