w***@163.com
w***@163.com
  • 发布:2024-12-11 10:47
  • 更新:2024-12-13 19:58
  • 阅读:120

uni.share 捕获n.index.share is not a function 错误

分类:uni-app

用uni.share分享给微信好友,可以分享成功,但在app.onError里能捕获一个错误,如下
TypeError: n.index.share is not a function
at Proxy.BindShare (https://usr/app-service.js:4494:1303)
at https://usr/app-service.js:4494:1852
at wr (https://usr/app-service.js:4395:34176)
at kr (https://usr/app-service.js:4395:34255)
at Function.a (https://usr/app-service.js:4395:75165)
at f (https://lib/WASubContext.js:1:147076)
at https://lib/WASubContext.js:1:147519
at Function.<anonymous> (https://lib/WASubContext.js:1:109936)
at Function.<anonymous> (https://lib/WASubContext.js:1:142408)
at p (https://lib/WAServiceMainContext.js:1:151340)

原始代码如下:
uni.share({
provider: provider,
scene: scene,
type: type,
title: title,
summary: summary,
href: href,
imageUrl: img,
miniProgram: minip,
success: function (res) {
console.log('[Share.Success]:' + JSON.stringify(res));
},
fail: function (err) {
console.error('[Share.Fail]:' + JSON.stringify(err));
}
});

在unpackage/dist/dev/mp-weixin 里的代码如下:
common_vendor.index.share({
provider,
scene,
type,
title,
summary,
href,
imageUrl: img,
miniProgram: minip,
success: function(res) {
console.log("[Share.Success]:" + JSON.stringify(res));
},
fail: function(err) {
console.log("[Share.Fail]:" + JSON.stringify(err));
}
});

2024-12-11 10:47 负责人:无 分享
已邀请:
7***@qq.com

7***@qq.com

请问你解决了吗 我也遇到了这个问题

要回复问题请先登录注册