关于小程序:微信小程序-设置-全局分享

7次阅读

共计 302 个字符,预计需要花费 1 分钟才能阅读完成。

onAppRoute 这个是小程序的一个暗藏的办法。本人能够打印看看
在 app.js 中

  onLaunch () {this.mpShare()
  },
  mpShare () {
    wx.onAppRoute(res => {const pages = getCurrentPages()
      const view = pages[pages.length - 1]
      if (view) {
        const data = view.data
        if (!data.isMpShare) {
          data.isMpShare = true
          view.onShareAppMessage = () => {
            return {
              title: '小程序',
              path: '/pages/home/home'
            }
          }
        }
      }
    })
  },
正文完
 0