发布时间:2025-06-24 19:30:10  作者:北方职教升学中心  阅读量:129


此时我们将删除ʄEntry 也会报告同样的错误,我们需要将军。

1.问题:

在鸿蒙ARKTS开发中遇到:

[Compile Result]  A page configured in 'main_pages.json' must have one and only one '@Entry' decorator.。

main_pages.json。

正确的文件内容:

{ "src": [ "pages/PageResource" ]}。刚才在HomePage中引用了Pageresource,两个页面都有修饰符和#xff0c;重复警告。(文件路径。

或者。(!不能注释,会报错,同时记得删除最后一个逗号。

 下面所有的page都必须有@Entry 修饰符。

#xff1文件内容a;

{ "src": [ "pages/PageResource", "pages/HomePage" ]}。main_pages.json。:entry > src > main > resources > base > profile > main_pages.json。

 。

{ "src": [ "pages/HomePage" ]}。

二、

 。
[Compile Result] Compile error occurred. Fix it based on the above message.。

[Compile Result] Compile error occurred. Fix it based on the above message.。可以删除文件中两个页面中的任何一个。解决方案:修改'main_pages.json'文件。