onShareAppMessage 好友转发,自己打开有内容,别人打开是空的,具体怎么解决?

小程序 文章 2022-04-24 09:40 0 全屏看文

onShareAppMessage 好友转发,自己打开有内容,别人打开是空的,具体怎么解决?onShareAppMessage is forwarded by friends, and there is content when I open it by myself, but it is empty when others open it. How to solve it?

onShareAppMessage 好友转发,自己打开有内容,别人打开是空的,具体怎么解决?
 onShareAppMessage(res) { //监听用户点击页面内转发按钮(button 组件 open-type="share")或右上角菜单“转发”按钮的行为,并自定义转发内容  console.log("分享好友", res)  const promise = new Promise(resolve => {    setTimeout(() => {      resolve({        titlethis.data.list.categotyList, //'自定义转发标题',      })    }, 2000)  })  return {    titlethis.data.list.categotyList, //'自定义转发标题',    path'/pages/index/pinglun/pinglun?id=' +this.data.list,    // imageUrl: this.data.list.img1,    promise  } },list是详情数组,


Onshareaappmessage (RES) {/ / listen to the user's behavior of clicking the forward button in the page (button component: open type = "share") or the "forward" button in the menu at the upper right corner, and customize the forwarding content: console.log ("share friends", RES) const {promise = new} promise (resolve = > {setTimeout (() = > {resolve( {Title: this. Data. List. Categotylist, / / 'custom forwarding title',})}, 2000)}) return {Title: this. Data. List. Categotylist, / / 'custom forwarding title', path: '/ pages / index / Pinglun / Pinglun? Id =' + this. Data. List, / / imageurl: this. Data. List. Img1, promise}}. The list is an array of details. Please point out, Is there anything wrong with me?


那一抹笑😃 穿透阳光:



为什么要加 resolve呢?

直接在外面 setData

然后分享的时候引用this.data.xxx 固定参数不就行了吗?



      resolve({        title: this.data.list.categotyList._id, //'这里增加了  ._id '刚才测试就可以了。      })