小程序为何有的页面可以分享给朋友有的不可以?需要在哪里设置么?

小程序 文章 2020-08-14 10:01 611 0 全屏看文

AI助手支持GPT4.0

小程序为何有的页面可以分享给朋友有的不可以?需要在哪里设置么?Why can some pages of the Mini Program be shared with friends and others? Where do I need to set it up?

小程序为何有的页面可以分享给朋友有的不可以?需要在哪里设置么?

如图,分享给朋友和朋友圈是灰色的,但是项目中有些页面则是高亮的。

As shown in the figure, sharing with friends and circle of friends is gray, but some pages in the project are highlighted.

回答:

搞文艺的猿:
//分享好友onShareAppMessage: function (res) {    if (res.from === 'button') {      // 来自页面内转发按钮      console.log(res.target)    }    return {      title: '自定义转发标题',      path: '/page/user?id=123'    }  }//在上面基础上加onShareTimeline: function (res) {    if (res.from === 'menu') {      // 来自页面内转发按钮      console.log(res.target)    }    return {      title: '自定义转发标题',      path: '/page/user?id=123'    }  }

具体可以js文件中查看,设置了就会高亮


搞文艺的猿:
陈强:

分享朋友设置

onShareAppMessage: function () {    return {        title: '',        imageUrl:'',        path:'',    }},


分享朋友圈设置

wx.showShareMenu({    menus: ['shareAppMessagewx', 'shareTimeline'],    withShareTicket:true});onShareTimeline: function () {    return {        title:'',        imageUrl:'',        query: '',    }},


参考文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E9%A1%B5%E9%9D%A2%E5%86%85%E5%8F%91%E8%B5%B7%E8%BD%AC%E5%8F%91

小布师叔:

删除掉这个onShareAppMessage函数就不可以分享

?:

设置分享就好了onsharemessage那个,页面配置最底部那个东西

จุ๊บ:
对应的页面  没有写 onShareAppMessage 这个分享


-EOF-

AI助手支持GPT4.0