测试时发现分享为小程序点不动,miniProgram的四个参数不能缺
btnShare(n) {
console.log(n) // 1微信好友,2微信朋友圈,3分享为小程序
// #ifdef APP-PLUS
let params = {
provider: 'weixin',
type: 0,
title: this.share.title,
summary: this.share.desc,
imageUrl: this.share.imgUrl,
href: this.$http.BaseUrl + `/h5/?share_path=` +
encodeURIComponent(
`/pages/index/index?pid=${this.$store.getters.user ? this.$store.getters.user.id : ''}`),
}
if (n == 1) {
params.scene = 'WXSceneSession'
} else if (n == 2) {
params.scene = 'WXSceneTimeline'
} else if (n == 3) {
params.scene = 'WXSceneSession'
params.type = 5;
params.miniProgram = {
id: '原始id', //微信公众平台登账号设置的基本设置最下面
path: this.share.path,
type: 1,
webUrl: 'http://uniapp.dcloud.io'
}
}
console.log(params,'share-params');
uni.share(params);
// #endif
},
点击后发现提示小程序与app没绑定同一账号,绑定一下就可以了