kbone开发的小程序加入分享到朋友圈模拟器报错
发布于 5 年前 作者 yeqiang 6074 次浏览 来自 官方Issues

在页面中加入如下代码

wx.showShareMenu({
      withShareTicket: true,
      menus: ["shareAppMessage", "shareTimeline"]
    });

    window.onShareAppMessage = () => {
      return {
        title: "标题"
      };
    };

    window.onShareTimeline = () => {
      console.log("onShareTimeline");
      return {
        title: "标题"
      };
    };

模拟器中触发右上角分享按钮可以出现分享到朋友圈功能,但是点击查看页面的时候开发者工具报错,打开页面空白,这个是BUG吗?

1 回复

昨晚才 publish,这么快就用上了:D

这个看起来是路径不对,可以更新下最新的 mp-webpack-plugin 然后重新构建一下?这里还要求打开 shareTimeline 配置(按照官方要求应该还要再打开 share 配置),具体可以参考文档:https://wechat-miniprogram.github.io/kbone/docs/domextend/#window-onsharetimeline

demo 里也有的:https://github.com/Tencent/kbone/tree/v2.x/examples/demo5

回到顶部