首页 > 其他分享 >A page must have one and only one ‘@Entry‘ decorator with a struct.【BUG已解决】

A page must have one and only one ‘@Entry‘ decorator with a struct.【BUG已解决】

时间:2022-10-19 11:07:50浏览次数:46  
标签:struct json BUG Compile only Entry page decorator

项目场景:

在学习基于OpenHarmony/HarmonyOS操作系统的ArkUI框架的过程中,使用DevEco Studio 3.0.0.993打开一个小的Demo的过程中。 打开Previewer的时候爆出如下错误:

mpile Result] A page configured in 'config.json' must have one and only one '@Entry' decorator. [Compile Result] Compile error occurred. Fix it based on the above message.

报错页面1: 在这里插入图片描述 报错页面2: 在这里插入图片描述

问题描述

出现如下报错: mpile Result] A page configured in 'config.json' must have one and only one '@Entry' decorator. Compile Result] Compile error occurred. Fix it based on the above message.

我的项目目录结构: 在这里插入图片描述

原因分析:

翻译结果: 在“config”中配置的页面。json'必须且只能有一个'@Entry'装饰器。 在config.json中“pages” : [ 配置了该文件 ],导致编译器认为此文件是页面,必须加修饰器@Entry。 发生编译错误。根据上面的消息修复它。

解决方案:

检查index.ets的文件开头是否引用了装饰器:@Entry。 在这里插入图片描述

import Myinput from "../common/componets/myinput"
@Entry
@Component
struct Index {
  @State message: string = 'OpenHarmony'
  @State username: string='1上进小菜猪23'
  @State password: string='3241'
  // @ts-ignore
  private username_reg= /^[0-9a-zA-Z]{5,8}/;

改正后检测,是否成功: 在这里插入图片描述 该BUG【A page must have one and only one '@Entry' decorator with a struct】成功解决。

标签:struct,json,BUG,Compile,only,Entry,page,decorator
From: https://blog.51cto.com/u_15568258/5768999

相关文章

  • 发现bug的方法论
    5.1测试用例(testcase)①什么是测试用例(testcase)?是为某个特殊目标而编制的一组测试输入、执行条件以及预期结果,以便测试某个程序路径或核实是否满足某个特定需求,其实也是......
  • ‘project JDK is not define‘ 解决方案 打开【File - Project Structure】 修改【M
    ‘projectJDKisnotdefine‘解决方案最近想玩玩javap反编译然后捣鼓来捣鼓去,出现了这个问题,解决方案之一1.打开【File-ProjectStructure】2.修改【Module......
  • _initialize()函数与 __construct()函数的区别
    _initialize()方法是在任何方法执行之前,都要执行的,当然也包括__construct构造函数。也就是说如果存在_initialize()函数,调用对象的任何方法都会导致_initialize()函数的自......
  • python 脚本实现bugly自动上传符号文件
    bugly更新之后,符号文件不再支持拖拽或者选择文件的方式上传了,官方提供了一个上传的工具包,通过buglyqq-upload-symbol.jar实现上传,每次上架app都需要手动去配置相关参数和组......
  • Go struct字段添加指针与不添加指针的区别
    packagemainimport("fmt")typeNstruct{Namestring`json:"name"`Ageint`json:"age"`B*BBB`json:"b"`}typeBBBstruct{yystringbbbyte......
  • 关于postgresql权限的一个bug
    PG中的bug根据SQL标准,一个模式的所有者总是拥有其中的所有对象。PostgreSQL允许模式包含由模式所有者以外的用户拥有的对象。这种情况才会发生在,当模式拥有者将模式的"CREAT......
  • BUG记录 ---- 小程序开发
    1.bug记录微信开发者工具公众号网页调试的调试器没了?改变打开开发者工具的方式,改为windows从任务栏打开工具!!!!而不是从快捷方式或者底部固定栏打开开发者工具里面的......
  • Data Structure: Tree & tree generator All In One
    DataStructure:Tree&treegeneratorAllInOne"usestrict";/****@authorxgqfrms*@licenseMIT*@copyrightxgqfrms*@created2022-10-10*@mod......
  • 如何在 Windows 上安装 ONLYOFFICE 文档 v7.2
    通过阅读本文,了解如何在Windows上安装ONLYOFFICE文档v7.2。引言使用社区版,您可以在本地服务器上安装ONLYOFFICE文档,并将在线编辑器与ONLYOFFICE协作平台​或其他热门系......
  • @PostConstruct详解
    定义:@PostConstruct是Java自带的注解,在方法上加该注解会在项目启动的时候执行该方法,也可以理解为在spring容器初始化的时候执行该方法。从JavaEE5规范开始,Servl......