微信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也已经拿到了,请问有人出现过这个错误吗,有没有什么解决方案呢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
官方有个客户端版本的要求