开发工具bug
getCredentials(){ return wepy.request({ url: 'cos/sts', method: "get", }) } async initCos(){ let result try { result = await this.getCredentials() } catch (error) { console.log(error); $Toast({ content: '出错了哦☹️', type: 'error' }); } var cos = new COS({ // ForcePathStyle: true, // 如果使用了很多存储桶,可以通过打开后缀式,减少配置白名单域名数量,请求时会用地域域名 getAuthorization: function (options, callback) { // 异步获取签名 var data = result.data; var credentials = data.credentials; callback({ TmpSecretId: credentials.tmpSecretId, TmpSecretKey: credentials.tmpSecretKey, XCosSecurityToken: credentials.sessionToken, ExpiredTime: data.expiredTime, // SDK 在 ExpiredTime 时间前,不会再次调用 getAuthorization }); } }); this.cos = cos } |
这个代码有错吗?为什么开发工具不执行,也不能调试,打印出result 创建cos实例的时候回调函数直接不执行



