1***@qq.com
1***@qq.com
  • 发布:2023-12-14 22:56
  • 更新:2023-12-18 19:55
  • 阅读:234

【报Bug】云对象调用报错,云对象部分是显示正常,但到页面一直报错

分类:uniCloud

产品分类: uniCloud/App

示例代码:
// 云对象  
module.exports = {  
    helloWd(text){  
        console.log('text', text);  
        return {  
            errCode: 1,  
            data: "hello, uni-app~"  
        }  
    }  
}
// 页面点击事件函数调用  
methods: {  
            async callTest(){  
                try{  
                    const demoTest = uniCloud.importObject("testIndex");  
                    let res = await demoTest.helloWd("hello");  
                    uni.showModal({  
                        content: JSON.stringify(res),  
                        showCancel: false  
                    })  
                }catch(e){  
                    //TODO handle the exception  
                    console.error("Error:", e);  
                }  
            }  
        }

操作步骤:

如上云对象代码,和页面点击事件函数执行,则会一直报错

预期结果:

不报错,正常返回数据

实际结果:

现在一直报错

bug描述:

云对象调用报错,云对象部分是显示正常,但到页面一直报错,麻烦看下什么原因

2023-12-14 22:56 负责人:无 分享
已邀请:
DCloud_uniCloud_VK

DCloud_uniCloud_VK

当errCode不是0的时候就会报错,因此你得返回errCode:0

要回复问题请先登录注册