• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @Entry:页面入口
2
3<!--Kit: ArkUI-->
4<!--Subsystem: ArkUI-->
5<!--Owner: @jiyujia926-->
6<!--Designer: @s10021109-->
7<!--Tester: @TerryTsao-->
8<!--Adviser: @zhang_yixin13-->
9
10@Entry装饰的自定义组件将作为UI页面的入口。
11
12> **说明:**
13>
14> 本模块首批接口从API version 7开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。
15
16## @Entry
17
18在单个UI页面中,仅允许存在一个由@Entry装饰的自定义组件作为页面的入口。
19
20**卡片能力:** 从API version 9开始,该接口支持在ArkTS卡片中使用。
21
22**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
23
24**系统能力:** SystemCapability.ArkUI.ArkUI.Full
25
26**示例:**
27
28```ts
29@Entry
30@Component
31struct Index {
32  build() {
33    Text('@Entry Test')
34  }
35}
36```
37
38## EntryOptions<sup>10+</sup>
39
40命名路由跳转选项。
41
42**卡片能力:** 从API version 10开始,该接口支持在ArkTS卡片中使用。
43
44**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
45
46**系统能力:** SystemCapability.ArkUI.ArkUI.Full
47
48**参数:**
49
50| 参数名                         | 类型                                                         | 必填 | 说明                                                         |
51| ------------------------------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
52| routeName                      | string                                                       | 否   | 表示作为命名路由页面的名字。<br/>**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 |
53| storage                        | [LocalStorage](../../../ui/state-management/arkts-localstorage.md) | 否   | 页面级的UI状态存储。<br/>**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 |
54| useSharedStorage<sup>12+</sup> | boolean                                                      | 否   | 是否使用[LocalContent](../arkts-apis-window-WindowStage.md#loadcontent9)传入的LocalStorage实例对象。默认值false。true:使用共享的LocalStorage实例对象。false:不使用共享的LocalStorage实例对象。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
55
56**示例:**
57
58```ts
59@Entry({routeName: 'myPage'})
60@Component
61struct Index {
62  build() {
63    Text('Index')
64  }
65}
66```
67
68