@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

Name Type Read-Only Optional Description
routeName string No Yes Name 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.
storage LocalStorage No Yes Stores 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+ boolean No Yes Whether 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')
  }
}