代码如下:通过这样分享出去的链接点击进来之后,场景值不是1044,这是为什么?是私密分享没有设置成功吗?
onLoad(options) {
if (options.from === 'share') {
console.log('来自分享进入');
} else {
console.log('来自常规路由进入');
}
const pages = getCurrentPages();
if (pages.length > 1) {
const prevPage = pages[pages.length - 2];
console.log("上一个页面:", prevPage.route);
}
console.log(options,"我是options")
this.handleGroupEntry(options);
this.activity_id = options.activityId;
this.from = options.from;
this.getActivityDetail()
},
async onShareAppMessage() {
let shareImg ='';
if(this.activity_info.multimedia && this.activity_info.multimedia.length){
shareImg = this.activity_info.multimedia[0].url
}else{
shareImg = '/static/share.png'
}
const res = await this.updateShareMenuSync();
console.log(res)
return {
title: this.activity_info.title,
path: `/pages/detail/detail?from=share&activityId=${this.activity_info.activity_id}`,
imageUrl: shareImg,
shareTicket: true ,
isPrivateMessage:true,
}
},
methods: {
updateShareMenuSync() {
return new Promise((resolve, reject) => {
wx.updateShareMenu({
withShareTicket: true,
isPrivateMessage:true,
menus: ['shareAppMessage', 'shareTimeline'],
success(res) {
resolve(res);
},
fail(err) {
reject(err);
}
});
});
},
}
试试我这样写
https://blog.csdn.net/qq_57952018/article/details/149031118