一、分享功能
1、分享朋友:onShareAppMessage(API)
onShareAppMessage(){
return {
title:'商协营',
path:'pages/home/index',
imageUrl:''
}
},
2、分享朋友圈:onShareTimeline (官方地址,API)
onShareTimeline(){
return {
title: this.articalUrlTitle,
query:'a=1',
imageUrl:''
}
3、获取自定义小程序码(前端可以用postman完成)(官方地址)
1)首先先获取小程序acess_token
const appid = '##########' //这两个找小程序项目备案的人拿
const secret = '#########'
// postman 路径+参数(get)
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${appid }&secret=${secret}
2)获取小程序码
const token = '##########' //第一步骤得到的acess_token
// postman 路径+参数(get)
https://api.weixin.qq.com/wxa/getwxacode?access_token=${token}
在postman的body的raw中加上json参数
{
"path":"pages/home/index?commerceCode=hzswzsh", // 自定路径
"env_version":"develop", // 版本-开发-体验-线上
"is_hyaline":true
}
4、消息订阅方案以及实现方法
据调研得知,为了用户良好体验感,小程序商用的消息订阅通知都是一次性的,发送完后,通道结束,需要提醒用户再次订阅
二、踩坑点:
1、分享朋友圈
含有webview组件的页面不能朋友圈转发