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'
            }
          }
        }
      }
    })
  },

原谅我一生不羁放歌搞文艺
383 声望12 粉丝

你就是很有想法。