关于微信小程序分享提示{"errMsg":"config:ok"}

提示javascript

{"errMsg":"config:ok"}html

{errMsg: "onMenuShareTimeline:ok"}java

{errMsg: "onMenuShareAppMessage"}api

缘由很简单 app

大佬,是否是你wx.config函数中debug为true;异步

看到网上说什么的都有,其实问题就是这么简单,函数

看文档看文档多看官网文档重要的事情说三遍 ~url

debug: false, // 开启调试模式,调用的全部api的返回值会在客户端alert出来,若要查看传入的参数,能够在pc端打开,参数信息会经过log打出,仅在pc端时才会打印。


wx.config({})成功之后 切记在
wx.ready(function() {
// 分享到朋友圈
wx.onMenuShareTimeline({
});
// 分享给朋友
wx.onMenuShareAppMessage({
});
});
代码以下
$.getJSON(
    "http://***:8888/?url=" +
      encodeURIComponent(window.location.href),
    function(result) {
      if (result.msg == "ok") {
        console.log(result.toString());
        var signature = result.signature;
        var timestamp = result.time_stamp;
        var nonce_str = result.nonce_str;

        wx.config({
          debug: false, // 开启调试模式,调用的全部api的返回值会在客户端alert出来,若要查看传入的参数,能够在pc端打开,参数信息会经过log打出,仅在pc端时才会打印。
          appId: "***********", // 必填,公众号的惟一标识
          timestamp: timestamp, // 必填,生成签名的时间戳
          nonceStr: nonce_str, // 必填,生成签名的随机串
          signature: signature, // 必填,签名,见附录1
          jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage"] // 必填,须要使用的JS接口列表,全部JS接口列表见附录2
        });

        wx.ready(function() {
          // config信息验证后会执行ready方法,全部接口调用都必须在config接口得到结果以后,config是一个客户端的异步操做,因此若是须要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则能够直接调用,不须要放在ready函数中。
          var img_url =
           "http://"+
            window.location.host +
            window.location.pathname +
            "static/image/share_logo.png";
          console.log(img_url);
          var title = $("h2.title").html();
          var link = window.location.href;
          // 分享到朋友圈
          wx.onMenuShareTimeline({
            imgUrl: img_url, // 分享图标
            link: link, // 分享连接
            desc: "", // 分享描述
            title: title, // 分享标题,
            success: function() {
              // 用户确认分享后执行的回调函数
              console.log("
            },
            cancel: function() {
              // 用户取消分享后执行的回调函数
              show_message("分享失败");
            }
          });
          // 分享给朋友
          wx.onMenuShareAppMessage({
            link: link, // 分享连接
            desc: "", // 分享描述
            title: title, // 分享标题,
            success: function() {
              console.log("分享给朋友");
              // 用户确认分享后执行的回调函数
            },
            cancel: function() {
              // 用户取消分享后执行的回调函数
            }
          });
        });
      } else {
      }
    }
  );