微信小程序按钮分享功能如何二次点击进入另一页面

微信小程序按钮分享功能如何二次点击进入另一页面
我点击按钮,员工注册时加了分享的功能,js中写了方法但是title显示不是我写的而且页面也没有分享我想分享的,我想问问可以实现吗,我这个功能好像没用,我分享后希望用户点击时是另一个页面,就是注册页面。

img

img

文档
https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareAppMessage-Object-object
代码
https://developers.weixin.qq.com/s/fWowy9mv7ZD7
示例

img


index.js

const app = getApp()

Page({
  data: {

  },
  onLoad() {
    console.log('代码片段是一种迷你、可分享的小程序或小游戏项目,可用于分享小程序和小游戏的开发经验、展示组件和 API 的使用、复现开发问题和 Bug 等。可点击以下链接查看代码片段的详细文档:')
    console.log('https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/devtools.html')
  },
  onShareAppMessage(e) {
    if (e.from === 'button') {
      console.log(e);
      return {
        title: 'xxxx',
        path: '/a/index'
      }
    }
  }
})

index.wxml

<view class="intro">欢迎使用代码片段,可在控制台查看代码片段的说明和文档</view>
<button open-type="share">分享</button>

onShareAppMessage方法不执行

onShareAppMessage中写入和更改分享的信息就可以了