onShareAppMessage里面发请求分享(小程序)

在文档的时候没看太明白,研究了一下子,发现文档理解还是比较难得
也看不懂的小伙伴可以直接使用辣

  onShareAppMessage() {
    const promise = new Promise(resolve => {
      request({
        api: '请求名',
        method: 'POST',
        data: {
          "data": {}
        }
      }).then(res => {
        resolve({
          title: '你要的标题',
          path: '/页面?code=' + res.code
        })
      })
    })
    return {promise}
  }

亲测有效哦

猜你喜欢

转载自blog.csdn.net/Yannnnnm/article/details/130266899