在这里插入图片描述

Route information is not configured for the current page. To avoid possible redirection issues, configure route information for the page.

Configure route information in D:\code\hongmeng\DevEcoStudioProjects\xxxx\Application\entry\src\main\resources\base\profile\main_pages.json

A preview error may have occurred. Switch to the Log tab to view details.

这个报错好久才找到,比较隐蔽

问题:
当我点击下面这个路由时,出现错误。
在这里插入图片描述
在这里插入图片描述
原因:
我写了三个页面(带有@Entry的)
在这里插入图片描述

其中
Lingin.ets、
Add.ets
是通过编辑器 new -> Page 创建出来的,我们知道这种方式,是会在main_pages.json 文件里自动配置好路由信息的

在这里插入图片描述

MainPage.ets是我手动创建的文件,所以配置文件main_pages.json里没有路由信息,我忘记了,然后就出现开头的错误

解决:
把所有页面的路由补充完整
在这里插入图片描述
如果帮到不请点个赞吧👍👍👍

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐