鸿蒙开发之修改启动页入口

路径:src/main/ets/entryability/EntryAbility.ets

`onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');

windowStage.loadContent('pages/Index', (err) => {//Index改为自己想要的页面
  if (err.code) {
    hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
    return;
  }
  hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});

}`

posted @ 2024-05-18 00:51  BH1PVG  阅读(96)  评论(0)    收藏  举报