/** * 应用入口:按登录态分流到登录页或主页。 * 页面间一律 router 路径跳转(页面已全部注册 main_pages),跨任务零 import。 */ import { router } from '@kit.ArkUI' import { AuthStore } from '../core/AuthStore' @Entry @Component struct Index { aboutToAppear(): void { const target = AuthStore.isLoggedIn() ? 'pages/HomePage' : 'pages/LoginPage' router.replaceUrl({ url: target }) } build() { Column() { LoadingProgress().width(48).height(48) Text('美搭') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ top: 12 }) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }