Closed lo0ong closed 5 years ago
你好,请核对业务需求。插件中 media.type 没有 Wechat.Type.LINK 选项。
你好,请核对业务需求。插件中 media.type 没有 Wechat.Type.LINK 选项。
我改成文字分享也是报错JSON error。
shareWX() {
if (typeof window.Wechat === "undefined") {
alert("Wechat plugin is not installed.");
return false;
}
Wechat.share({
text:"政委我呢我吧而无法被文化部防护而并非而并非不如",
scene: 0 // share to Timeline
}, function () {
alert("Success");
}, function (reason) {
alert("分享失败: " + reason);
});
}
Wechat.share({ message: { title: "1111111111111", description: "这是一个回答的页面", thumb: this.content.imgs[0], media: { type: Wechat.Type.MINI, webpageUrl: "https://github.com/xu-li/cordova-plugin-wechat/blob/develop/README_CN.md", // 兼容低版本的网页链接 userName: "gh_faa299dd0c3e", // 小程序原始id path: "pages/content-answer/content-answer", // 小程序的页面路径 hdImageData: new Blob([this.content.imgs[0]], { type: 'image/png' }), // 程序新版本的预览图二进制数据 不超过128kb withShareTicket: true, // 是否使用带shareTicket的分享 miniprogramType: 1//正式版:0,测试版:1,体验版:2 } }, scene: Wechat.Scene.SESSION, }, (success) => { alert(success) }, (error) => { alert('微信分享失败' + error); });
如果不加title,description,thumb 同样报错JSON error;
加上之后闪退APP
@lo0ong @wh0714 请使用master分支代码 或更新插件到2.7.1
@jasonz1987
更新到2.7.1 还是同样的问题,
这是我的测试代码
Wechat.share({ message: { // title: this.content.title, // description: "这是一个回答的页面", // thumb: this.content.imgs[0], media: { type: Wechat.Type.MINI, webpageUrl: "https://github.com/xu-li/cordova-plugin-wechat/blob/develop/README_CN.md", // 随便放的链接 userName: "gh_faa299dd0c3e", // 小程序原始id path: "pages/recommend/recommend", // 小程序的页面路径 hdImageData: new Blob([this.content.imgs[0]], { type: 'image/png' }), // 程序新版本的预览图二进制数据 不超过128kb withShareTicket: true, // 是否使用带shareTicket的分享 miniprogramType: 0//正式版:0,测试版:1,体验版:2 } }, scene: Wechat.Scene.SESSION, }, (success) => { alert(success) }, (error) => { alert('微信分享失败' + error); })
升级之后的版本
@wh0714 你传入的hdImageData 插件不支持 建议更换为base64,本地路径,或者在线地址
@jasonz1987 thanks, 我传入图片太大并且不是指定的类型 下面是成功的例子;