诸葛龙ovo
诸葛龙ovo
  • 发布:2024-03-08 16:43
  • 更新:2024-06-25 15:48
  • 阅读:341

【报Bug】TypeError: Cannot read properties of undefined (reading 'onLoad')

分类:uni-app

产品分类: uniapp/快应用/华为

渲染模式: webview

示例代码:

index.vue中代码如下:

<template>  
    <view class="content">  
        <image class="logo" src="/static/logo.png"></image>  
        <view class="text-area">  
            <text class="title">{{title}}</text>  
        </view>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                title: 'Hello'  
            }  
        },  
        onLoad() {  

        },  
        methods: {  

        }  
    }  
</script>  

<style>  
    .content {  
        display: flex;  
        flex-direction: column;  
        align-items: center;  
        justify-content: center;  
    }  

    .logo {  
        height: 200rpx;  
        width: 200rpx;  
        margin-top: 200rpx;  
        margin-left: auto;  
        margin-right: auto;  
        margin-bottom: 50rpx;  
    }  

    .text-area {  
        display: flex;  
        justify-content: center;  
    }  

    .title {  
        font-size: 36rpx;  
        color: #8f8f94;  
    }  
</style>  

操作步骤:

使用hbuilderx工具新建uniapp项目,选择默认模板,vue版本选择vue3,不勾选uni-app x选项以及启用uniCloud选项。创建成功后发布为华为快应用,使用华为快应用打开发布的包,运行到调试手机。

预期结果:

正常显示基础效果

实际结果:

报错

bug描述:

使用HBuilderx工具创建了一个基础的vue3项目,打包为华为快应用。运行到华为快应用工具后报错信息如下:

03-08 16:23:19.510 E/jsLog   (24926): Runtime Error, Page : pages/index/index  
03-08 16:23:19.510 E/jsLog   (24926): Runtime Error, ErrorCode :   
03-08 16:23:19.511 E/jsLog   (24926): TypeError: Cannot read properties of undefined (reading 'onLoad')  
03-08 16:23:19.511 E/jsLog   (24926):     at Yi (hbs:3090:22)  
03-08 16:23:19.511 E/jsLog   (24926):     at Component.attached (hbs:3012:13)  
03-08 16:23:19.511 E/jsLog   (24926):     at hbs-frk:1:221816  
03-08 16:23:19.511 E/jsLog   (24926):     at Array.forEach (<anonymous>)  
03-08 16:23:19.511 E/jsLog   (24926):     at t (hbs-frk:1:221789)  
03-08 16:23:19.511 E/jsLog   (24926):     at Component.disposeLifetime (hbs-frk:1:221970)  
03-08 16:23:19.511 E/jsLog   (24926):     at hbs-frk:1:223117  
03-08 16:23:19.511 E/jsLog   (24926):     at Array.forEach (<anonymous>)  
03-08 16:23:19.511 E/jsLog   (24926):     at Component._triggerLifetime (hbs-frk:1:223081)  
03-08 16:23:19.511 E/jsLog   (24926):     at triggerLifetime (hbs-frk:1:236564)
2024-03-08 16:43 负责人:无 分享
已邀请:
JXWang

JXWang

感谢您的反馈,已复现该问题,已加分,我们排查一下

s***@163.com

s***@163.com

有结果了吗

要回复问题请先登录注册