openharmony 鸿蒙 ts-universal-entry

2026-08-25 浏览 (1)

@Entry: Page Entry Declaration

The custom component decorated with @Entry is used as the entry of the UI page.

NOTE

The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.

@Entry

A single page can only have one @Entry decorated custom component serving as its entry.

Widget capability: This API can be used in ArkTS widgets since API version 9.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.ArkUI.ArkUI.Full

Example

@Entry
@Component
struct Index {
  build() {
    Text('@Entry Test')
  }
}

EntryOptions10+

Describes the named route options.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameTypeRead-OnlyOptionalDescription
routeNamestringNoYesName of the target named route.
Widget capability: This API can be used in ArkTS widgets since API version 10.
Atomic service API: This API can be used in atomic services since API version 11.
storageLocalStorageNoYesStores page-level UI status. If no value is passed, the framework creates a new LocalStorage instance as the default value.
Widget capability: This API can be used in ArkTS widgets since API version 10.
Atomic service API: This API can be used in atomic services since API version 11.
useSharedStorage12+booleanNoYesWhether to use the LocalStorage instance passed by loadContent. The default value is false. true: Use the shared LocalStorage instance. false: Do not use the shared LocalStorage instance.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.

Example

@Entry({ routeName: 'myPage' })
@Component
struct Index {
  build() {
    Text('Index')
  }
}

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 ts-drawing-components-shape

openharmony 鸿蒙 ts-universal-attributes-sharp-clipping

openharmony 鸿蒙 ts-universal-attributes-toolbar

openharmony 鸿蒙 ts-container-lazyvgridlayout

openharmony 鸿蒙 ohos-arkui-advanced-FoldSplitContainer

openharmony 鸿蒙 ts-methods-calendarpicker-dialog

openharmony 鸿蒙 ts-uicommonevent

openharmony 鸿蒙 ts-basic-gestures-tapgesture

openharmony 鸿蒙 ohos-arkui-advanced-DialogV2

openharmony 鸿蒙 ts-components-canvas-canvas

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/378J1V6s