y***@yeah.net
y***@yeah.net
  • 发布:2022-03-24 11:23
  • 更新:2022-04-06 20:01
  • 阅读:551

unicloud-db 在百度小程序报错:call Component onInit method fail

分类:uniCloud

[Lifecycle Error] call Component onInit method fail:
Cannot read property 'catchhook:onInit' of undefined
TypeError: [Lifecycle Error] call Component onInit method fail:
Cannot read property 'catchhook:onInit' of undefined

<template>  
    <view>  
        <unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="formData"  collection="opendb-news-articles"  
         field="_id,title" :where="where" @load="load">  
            <view v-for="item in data">  
                {{item.title}}  
            </view>  
        </unicloud-db>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                where: "",  
                formData: {  
                    waterfall: false, // 布局方向切换  
                    status: 'loading', // 加载状态  
                },  
            }  
        },  
        onLoad(){  

        },  
        methods: {  
            load(data, ended) {  
                if (ended) {  
                    this.formData.status = 'noMore'  
                }  
            },  
        }  
    }  
</script>
2022-03-24 11:23 负责人:无 分享
已邀请:
DCloud_uniAD_HDX

DCloud_uniAD_HDX

已排查你的工程,作用域插槽内部不能直接访问 data 上的属性,可以通过 options 透传
解决方案:移除 {{where}}

DCloud_uniAD_HDX

DCloud_uniAD_HDX

提供下百度开发者工具的版本号和HBuilderX的版本号

  • y***@yeah.net (作者)

    HBuilder X 3.3.13.20220314 百度开发者工具版本号 3.52.1 百度开发者工具用的是测试账号(appid=touristappid)

    2022-03-28 09:11

  • y***@yeah.net (作者)

    麻烦官方大大看下问题哈

    2022-04-01 16:34

DCloud_uniAD_HDX

DCloud_uniAD_HDX

测试没有发现问题,提供一个简单的测试工程吧

  • y***@yeah.net (作者)

    已经在回复中发送测试工程了哈,辛苦官方大大

    2022-04-02 14:18

y***@yeah.net

y***@yeah.net (作者)

测试工程,请查收。

该问题目前已经被锁定, 无法添加新回复