我不知道你用的什么版本,我是昨天在 github 上下的 demo,同样的错误,在 addCgi.js 里修改
testCgi: function () {
util.showBusy('请求中...')
var that = this
qcloud.request({
url: `${config.service.host}/weapp/demo`,
login: false,
success (result) {
util.showSuccess('请求成功完成')
that.setData({
requestResult: JSON.stringify(result.data)
})
},
fail (error) {
util.showModel('请求失败', error);
console.log('request fail', error);
}
})
}
这里 login: false,我改成 true 就好了