小程序间跨账号资源共享时,提示未开通云开发?
发布于 5 年前 作者 qiang14 9615 次浏览 来自 问答
var cloud = new wx.cloud({
      resourceAppid:'wx5d8d765e252720eb',
      resourceEnv:'production-rjntq'
    })

cloud.init()

Error: errCode: -1  | errMsg: Cloud API isn’t enabled, please call wx.cloud.init first

请先调用 wx.cloud.init() 完成初始化后再调用其他云 API。

    at new u (VM446 WAService.js:2)

    at Object.exportAPI.<computed> (VM446 WAService.js:2)

    at Object.p.<computed> [as callFunction] (VM446 WAService.js:2)

    at _callee3$ (user.js:30)

    at f (VM446 WAService.js:2)

    at Generator.u._invoke (VM446 WAService.js:2)

    at Generator.next (VM446 WAService.js:2)

    at asyncGeneratorStep (asyncToGenerator.js:1)

    at c (asyncToGenerator.js:1)

    at asyncToGenerator.js:1

参考文章:

https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/resource-sharing/

如果我换个写法

wx.cloud.init({
        resourceAppid:'wx5d8d765e252720eb',
        resourceEnv:'production-rjntq'
      })

报错就是

VM685:1 Error: invalid scope 没有权限,请先开通云服务

    at Function.fail (VM691 WAService.js:2)

    at h (VM691 WAService.js:2)

    at Object.fail (VM691 WAService.js:2)

    at v (VM691 WAService.js:2)

    at VM691 WAService.js:2

    at e.<anonymous> (VM690 asdebug.js:1)

    at h (VM691 WAService.js:2)

    at VM691 WAService.js:2

    at VM691 WAService.js:2

这个【小程序环境共享】到底要怎么用,求官方出个能用的demo或者教程,十分感谢

1 回复
回到顶部