注意事项:
uni.share分享到微信可以使用网络图片,但是分享到QQ时需要用uni.downloadFile下载后使用
if (provider == "qq") {
uni.downloadFile({
url: imgUrl, // 要分享的网络图片链接
success: (res) => {
if (res.statusCode == 200) {
uni.share({
provider: 'qq',
type: 2,
imageUrl: res.tempFilePath,
href: '', // 分享图片到qq时必填但可置空
success: function(res) {
console.log(res);
},
fail: function(err) {
console.log(err);
}
});
}
}
})
}
=====2021-04-03更新=====
**share:fail [ShareQQ:5]未知错误
{
"errMsg": "share:fail [ShareQQ:5]未知错误,https://ask.dcloud.net.cn/article/287",
"errCode": -100,
"code": -100
}
检查分享的url中是否包含中文,使用encodeURIComponent(JSON.stringify(‘中文部分’))将中文进行转码**
/pages/test/test?item='+ encodeURIComponent(JSON.stringify(item))
0 个评论
要回复文章请先登录或注册