收藏
回答

微信开发1.4.0分享接口报错

项目引用jweixin-1.4.0.js做分享,但是报错
{"errMsg":"updateAppMessageShareData:没有此SDK或暂不支持此SDK模拟"}

const wx = require('./jweixin-1.4.0.js');
// 分享配置
const share = {
    title: "标题",
    desc: "描述",
    link: "链接",
    imgUrl: "图片"
};
// 微信鉴权设置
const wxOpt = {
    userid: "",
    debug: 1,
    appId: "",
    timestamp: "",
    noncestr: "",
    signature: "",
    apis: [
        "hideMenuItems", "showMenuItems", "hideAllNonBaseMenuItem", "showAllNonBaseMenuItem",
        "translateVoice", "startRecord", "stopRecord", "onRecordEnd", "playVoice", "pauseVoice",
        "stopVoice", "uploadVoice", "downloadVoice", "chooseImage", "previewImage", "uploadImage",
        "downloadImage", "getNetworkType", "openLocation", "getLocation", "hideOptionMenu", "showOptionMenu",
        "closeWindow", "scanQRCode", "chooseWXPay", "openProductSpecificView", "addCard", "chooseCard", "openCard",
        "onMenuShareTimeline", "onMenuShareAppMessage", "updateAppMessageShareData","updateTimelineShareData"
    ]
};
export default {
    init() {
        wx.config({
            debug: wxOpt.debug,
            appId: wxOpt.appId,
            timestamp: wxOpt.timestamp,
            nonceStr: wxOpt.noncestr,
            signature: wxOpt.signature,
            jsApiList: wxOpt.apis
        })
    },
    getWxConfig() {
        $.ajax({
            url: "",
            type: "POST",
            data: {
                hash: 'less',
                url: window.location.href.split("#")[0]
            },
            async: !1,
            dataType: "json",
            success(e) {
                $.extend(wxOpt, e.data);
            }
        })
    },
    Handler() {
        this.getWxConfig();
        this.init();
        wx.ready(function () {
            wx.hideMenuItems({
                menuList: ["menuItem:share:weiboApp", "menuItem:share:facebook", "menuItem:openWithQQBrowser", "menuItem:openWithSafari", "menuItem:share:email","menuItem:share:qq","menuItem:share:weiboApp","menuItem:share:QZone"]
            });
            wx.updateTimelineShareData({
                title: share.title,
                imgUrl: share.imgUrl,
                link: share.link,
                success: function () {
                }
            });
            wx.updateAppMessageShareData({
                title: share.title,
                desc: share.desc,
                imgUrl: share.imgUrl,
                link: share.link,
                success: function () {
                }
            });
            wx.onMenuShareTimeline({//(即将废弃)
                title: share.title, // 分享标题
                link: share.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                imgUrl: share.imgUrl, // 分享图标
                success: function () {
                    // 用户点击了分享后执行的回调函数
                },});
            wx.onMenuShareAppMessage({//(即将废弃)
                title: share.title, // 分享标题
                desc: share.desc, // 分享描述
                link: share.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                imgUrl: share.imgUrl, // 分享图标
                type: 'link', // 分享类型,music、video或link,不填默认为link
                dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
                success: function () {
// 用户点击了分享后执行的回调函数
                }
            });
        })
    },
};



微信打印也显示权限获取到了,但是还是报这个错误
jsapi也已经拿到了,请问有人出现过这个错误吗,有没有什么解决方案呢

回答关注问题邀请回答
收藏

2 个回答

  • Stay
    Stay
    2019-04-15

    在vue里面为啥放在mounted()里面进入页面就提示分享成功了,在点击分享就没有反应了,分享也不成功了,求解,谢谢

    2019-04-15
    有用
    回复 1
    • 张晓甜
      张晓甜
      2019-04-24

      新的这个貌似 是 设置成功 ,而不是 分享的回调, 之后的分享也是不提供分享的回调监听了

      2019-04-24
      回复
  • 祺爸💎
    祺爸💎
    2019-02-27

    开发者工具上好像不支持最新的分享接口

    2019-02-27
    有用
    回复
登录 后发表内容