1e41f4b71Sopenharmony_ci# NavDestination
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci作为子页面的根容器,用于显示[Navigation](ts-basic-components-navigation.md)的内容区。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> 该组件从API Version 11开始默认支持安全区避让特性(默认值为:expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])),开发者可以重写该属性覆盖默认行为,API Version 11之前的版本需配合[expandSafeArea](ts-universal-attributes-expand-safe-area.md)属性实现安全区避让。
10e41f4b71Sopenharmony_ci>
11e41f4b71Sopenharmony_ci> NavDestination组件必须配合Navigation使用,作为Navigation目的页面的根节点,单独使用只能作为普通容器组件,不具备路由相关属性能力。
12e41f4b71Sopenharmony_ci>
13e41f4b71Sopenharmony_ci> 如果页面栈中间页面的生命周期发生变化,跳转之前的栈顶Destination的生命周期(onWillShow, onShown, onHidden, onWillDisappear)与跳转之后的栈顶Destination的生命周期(onWillShow, onShown, onHidden, onWillDisappear)均在最后触发。
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## 子组件
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci> **说明:**
18e41f4b71Sopenharmony_ci>
19e41f4b71Sopenharmony_ci> - 子组件类型:系统组件和自定义组件,支持渲染控制类型([if/else](../../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../../quick-start/arkts-rendering-control-lazyforeach.md))。
20e41f4b71Sopenharmony_ci> - 子组件个数:多个。
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci## 接口
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciNavDestination()
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci## 属性
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci支持[通用属性](ts-universal-attributes-size.md)。
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci不推荐设置位置、大小等布局相关属性,可能会造成页面显示异常。
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci### title
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_cititle(value: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle | Resource, options?: NavigationTitleOptions)
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci设置页面标题。使用NavigationCustomTitle类型设置height高度时,[titleMode](ts-basic-components-navigation.md#titlemode)属性不会生效。字符串超长时,如果不设置副标题,先缩小再换行2行后以...截断。如果设置副标题,先缩小后以...截断。
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**参数:** 
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci| 参数名 | 类型                                                         | 必填 | 说明       |
50e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ---------- |
51e41f4b71Sopenharmony_ci| value  | string \| [CustomBuilder](ts-types.md#custombuilder8) \| [NavDestinationCommonTitle](#navdestinationcommontitle) \| [NavDestinationCustomTitle](#navdestinationcustomtitle) | 是   | 页面标题。 |
52e41f4b71Sopenharmony_ci| options<sup>12+</sup> | [NavigationTitleOptions](ts-basic-components-navigation.md#navigationtitleoptions11) | 否   | 标题栏选项。 |
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci### hideTitleBar
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_cihideTitleBar(value: boolean)
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci设置是否隐藏标题栏。
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci**参数:** 
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci| 参数名 | 类型    | 必填 | 说明                                                         |
67e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ |
68e41f4b71Sopenharmony_ci| value  | boolean | 是   | 是否隐藏标题栏。<br/>默认值:false<br/>true:&nbsp;隐藏标题栏。<br/>false:&nbsp;显示标题栏。 |
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci### hideTitleBar<sup>14+</sup>
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_cihideTitleBar(hide: boolean, animated: boolean)
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci设置是否隐藏标题栏,设置是否使用动画显隐标题栏。
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 14开始,该接口支持在原子化服务中使用。
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci**参数:** 
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci| 参数名 | 类型    | 必填 | 说明                                                         |
83e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ |
84e41f4b71Sopenharmony_ci| hide  | boolean | 是   | 是否隐藏标题栏。<br/>默认值:false<br/>true: 隐藏标题栏。<br/>false: 显示标题栏。 |
85e41f4b71Sopenharmony_ci| animated  | boolean | 是   | 设置是否使用动画显隐标题栏。<br/>默认值:false<br/>true: 使用动画显示隐藏标题栏。<br/>false: 不使用动画显示隐藏标题栏。 |
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci### toolbarConfiguration<sup>14+</sup>
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_citoolbarConfiguration(value: Array&lt;ToolbarItem&gt; | CustomBuilder, options?: NavigationToolbarOptions)
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci设置工具栏内容。未调用本接口时不显示工具栏。
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci**卡片能力:** 从API version 14开始,该接口支持在ArkTS卡片中使用。
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 14开始,该接口支持在原子化服务中使用。
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci**参数:** 
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci| 参数名  | 类型                                                         | 必填 | 说明                                                         |
102e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
103e41f4b71Sopenharmony_ci| value   | &nbsp;Array&lt;[ToolbarItem](ts-basic-components-navigation.md#toolbaritem10)&gt; &nbsp;\|&nbsp;[CustomBuilder](ts-types.md#custombuilder8) | 是   | 工具栏内容。<br/>使用Array&lt;[ToolbarItem](ts-basic-components-navigation.md#toolbaritem10)&gt;写法设置的工具栏有如下特性:<br/>-工具栏所有选项均分底部工具栏,在每个均分内容区布局文本和图标。<br/>-文本超长时,若工具栏选项个数小于5个,优先拓展选项的宽度,工具栏最大宽度与屏幕等宽,其次逐级缩小,缩小之后换行,最后...截断。<br/>-竖屏最多支持显示5个图标,多余的图标会被放入自动生成的更多图标中,点击更多图标,可以展示剩余内容。横屏时,如果为[Split](ts-basic-components-navigation.md#navigationmode9枚举说明)模式,仍按照竖屏规则显示,如果为[Stack](ts-basic-components-navigation.md#navigationmode9枚举说明)模式需配合menus属性的Array&lt;[NavigationMenuItem](ts-basic-components-navigation.md#navigationmenuitem)&gt;使用,底部工具栏会自动隐藏,同时底部工具栏所有选项移动至页面右上角菜单。<br/>使用[CustomBuilder](ts-types.md#custombuilder8)写法为用户自定义工具栏选项,除均分底部工具栏外不具备以上功能。 |
104e41f4b71Sopenharmony_ci| options | [NavigationToolbarOptions](ts-basic-components-navigation.md#navigationtoolbaroptions11) | 否   | 工具栏选项。                                                 |
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci> **说明:**
107e41f4b71Sopenharmony_ci>
108e41f4b71Sopenharmony_ci> 不支持通过SymbolGlyphModifier对象的fontSize属性修改图标大小、effectStrategy属性修改动效、symbolEffect属性修改动效类型。
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci### hideToolBar<sup>14+</sup>
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_cihideToolBar(hide: boolean, animated?: boolean)
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci设置是否隐藏工具栏,设置是否使用动画显隐工具栏。
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 14开始,该接口支持在原子化服务中使用。
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci**参数:** 
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci| 参数名 | 类型    | 必填 | 说明                                                         |
123e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ |
124e41f4b71Sopenharmony_ci| hide  | boolean | 是   | 是否隐藏工具栏。<br/>默认值:false<br/>true: 隐藏工具栏。<br/>false: 显示工具栏。 |
125e41f4b71Sopenharmony_ci| animated  | boolean | 否   | 设置是否使用动画显隐工具栏。<br/>默认值:false<br/>true: 使用动画显示隐藏工具栏。<br/>false: 不使用动画显示隐藏工具栏。 |
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci### mode <sup>11+</sup>
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_cimode(value: NavDestinationMode)
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci设置NavDestination类型,不支持动态修改。
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ci**参数:** 
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ci| 参数名 | 类型                                                 | 必填 | 说明                                                         |
140e41f4b71Sopenharmony_ci| ------ | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
141e41f4b71Sopenharmony_ci| value  | [NavDestinationMode](#navdestinationmode枚举说明-11) | 是   | NavDestination类型。<br/>默认值: NavDestinationMode.STANDARD |
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci### backButtonIcon<sup>11+</sup>
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_cibackButtonIcon(value: ResourceStr | PixelMap | SymbolGlyphModifier)
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci> **说明:**
148e41f4b71Sopenharmony_ci>
149e41f4b71Sopenharmony_ci> 不支持通过SymbolGlyphModifier对象的fontSize属性修改图标大小、effectStrategy属性修改动效、symbolEffect属性修改动效类型。
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci设置标题栏返回键图标。
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci**参数:** 
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci| 参数名 | 类型                                                         | 必填 | 说明               |
161e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------ |
162e41f4b71Sopenharmony_ci| value  | [ResourceStr](ts-types.md#resourcestr)&nbsp;\|&nbsp;[PixelMap](../../apis-image-kit/js-apis-image.md#pixelmap7)&nbsp;\|&nbsp;[SymbolGlyphModifier<sup>12+</sup>](ts-universal-attributes-attribute-modifier.md)  | 是   | 标题栏返回键图标。 |
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci### menus<sup>12+</sup>
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_cimenus(value: Array&lt;NavigationMenuItem&gt; | CustomBuilder)
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci> **说明:**
169e41f4b71Sopenharmony_ci>
170e41f4b71Sopenharmony_ci> 不支持通过SymbolGlyphModifier对象的fontSize属性修改图标大小、effectStrategy属性修改动效、symbolEffect属性修改动效类型。
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci
173e41f4b71Sopenharmony_ci设置页面右上角菜单。不设置时不显示菜单项。使用Array<[NavigationMenuItem](ts-basic-components-navigation.md#navigationmenuitem)&gt; 写法时,竖屏最多支持显示3个图标,横屏最多支持显示5个图标,多余的图标会被放入自动生成的更多图标。
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci**参数:** 
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_ci| 参数名 | 类型                                                         | 必填 | 说明               |
182e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------ |
183e41f4b71Sopenharmony_ci| value  | Array<[NavigationMenuItem](ts-basic-components-navigation.md#navigationmenuitem)&gt;&nbsp;\|&nbsp;[CustomBuilder](ts-types.md#custombuilder8) | 是   | 页面右上角菜单。 |
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci### ignoreLayoutSafeArea<sup>12+</sup>
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ciignoreLayoutSafeArea(types?: Array&lt;LayoutSafeAreaType&gt;, edges?: Array&lt;LayoutSafeAreaEdge&gt;)
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci控制组件的布局,使其扩展到非安全区域
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci**参数:** 
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ci| 参数名 | 类型                                               | 必填 | 说明                                                         |
198e41f4b71Sopenharmony_ci| ------ | -------------------------------------------------- | ---- | ------------------------------------------------------------ |
199e41f4b71Sopenharmony_ci| types  | Array <[LayoutSafeAreaType](ts-types.md#layoutsafeareatype12)> | 否   | 配置扩展安全区域的类型。<br />默认值: <br />[LayoutSafeAreaType.SYSTEM] |
200e41f4b71Sopenharmony_ci| edges  | Array <[LayoutSafeAreaEdge](ts-types.md#layoutsafeareaedge12)> | 否   | 配置扩展安全区域的方向。<br /> 默认值: <br />[LayoutSafeAreaEdge.TOP, LayoutSafeAreaEdge.BOTTOM]。|
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_ci>  **说明:**
203e41f4b71Sopenharmony_ci>   
204e41f4b71Sopenharmony_ci>  组件设置LayoutSafeArea之后生效的条件为:   
205e41f4b71Sopenharmony_ci>  设置LayoutSafeAreaType.SYSTEM时,组件的边界与非安全区域重合时组件能够延伸到非安全区域下。例如:设备顶部状态栏高度100,组件在屏幕中纵向方位的绝对偏移需要在0到100之间。  
206e41f4b71Sopenharmony_ci>   
207e41f4b71Sopenharmony_ci>  若组件延伸到非安全区域内,此时在非安全区域里触发的事件(例如:点击事件)等可能会被系统拦截,优先响应状态栏等系统组件。
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ci### systemBarStyle<sup>12+</sup>
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_cisystemBarStyle(style: Optional&lt;SystemBarStyle&gt;)
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ci当Navigation中显示当前NavDestination时,设置对应系统状态栏的样式。
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ci**参数:** 
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci| 参数名 | 类型         | 必填 | 说明               |
222e41f4b71Sopenharmony_ci| ------ | -------------- | ---- | ------------------ |
223e41f4b71Sopenharmony_ci| style  | Optional&lt;[SystemBarStyle](../js-apis-window.md#systembarstyle12)&gt; | 是   | 系统状态栏样式。 |
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ci> **说明:**
226e41f4b71Sopenharmony_ci>
227e41f4b71Sopenharmony_ci> 1. 必须配合Navigation使用,作为其Navigation目的页面的根节点时才能生效。
228e41f4b71Sopenharmony_ci> 2. 其他使用限制请参考Navigation对应的[systemBarStyle](ts-basic-components-navigation.md#systembarstyle12)属性说明。
229e41f4b71Sopenharmony_ci
230e41f4b71Sopenharmony_ci## NavDestinationMode枚举说明 <sup>11+</sup>
231e41f4b71Sopenharmony_ci
232e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
233e41f4b71Sopenharmony_ci
234e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
235e41f4b71Sopenharmony_ci
236e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ci| 名称   | 说明                                     |
239e41f4b71Sopenharmony_ci| ---- | ---------------------------------------- |
240e41f4b71Sopenharmony_ci| STANDARD | 标准模式的NavDestination。                       |
241e41f4b71Sopenharmony_ci| DIALOG | 默认透明,进出页面栈不影响下层NavDestination的生命周期。<br />API version 13之前,默认无系统转场动画。从API version 13开始,支持系统转场动画。  |
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci## 事件
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci除支持[通用事件](ts-universal-events-click.md)外,还支持如下事件:
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci### onShown<sup>10+</sup>
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_cionShown(callback:&nbsp;()&nbsp;=&gt;&nbsp;void)
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci当该NavDestination页面显示时触发此回调。
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci### onHidden<sup>10+</sup>
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_cionHidden(callback:&nbsp;()&nbsp;=&gt;&nbsp;void)
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci当该NavDestination页面隐藏时触发此回调。
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci### onWillAppear<sup>12+</sup>
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_cionWillAppear(callback: Callback\<void>)
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci当该Destination挂载之前触发此回调。在该回调中允许修改页面栈,当前帧生效。
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci### onWillShow<sup>12+</sup>
278e41f4b71Sopenharmony_ci
279e41f4b71Sopenharmony_cionWillShow(callback: Callback\<void>)
280e41f4b71Sopenharmony_ci
281e41f4b71Sopenharmony_ci当该Destination显示之前触发此回调。
282e41f4b71Sopenharmony_ci
283e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
284e41f4b71Sopenharmony_ci
285e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
286e41f4b71Sopenharmony_ci
287e41f4b71Sopenharmony_ci### onWillHide<sup>12+</sup>
288e41f4b71Sopenharmony_ci
289e41f4b71Sopenharmony_cionWillHide(callback: Callback\<void>)
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_ci当该Destination隐藏之前触发此回调。
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
296e41f4b71Sopenharmony_ci
297e41f4b71Sopenharmony_ci### onWillDisappear<sup>12+</sup>
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_cionWillDisappear(callback: Callback\<void>)
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci当该Destination卸载之前触发的生命周期(有转场动画时,在转场动画开始之前触发)。
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
304e41f4b71Sopenharmony_ci
305e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
306e41f4b71Sopenharmony_ci
307e41f4b71Sopenharmony_ci### onBackPressed<sup>10+</sup>
308e41f4b71Sopenharmony_ci
309e41f4b71Sopenharmony_cionBackPressed(callback:&nbsp;()&nbsp;=&gt;&nbsp;boolean)
310e41f4b71Sopenharmony_ci
311e41f4b71Sopenharmony_ci当与Navigation绑定的页面栈中存在内容时,此回调生效。当点击返回键时,触发该回调。
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci返回值为true时,表示重写返回键逻辑,返回值为false时,表示回退到上一个页面。
314e41f4b71Sopenharmony_ci
315e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
316e41f4b71Sopenharmony_ci
317e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
318e41f4b71Sopenharmony_ci
319e41f4b71Sopenharmony_ci### onReady<sup>11+</sup>
320e41f4b71Sopenharmony_ci
321e41f4b71Sopenharmony_cionReady(callback:&nbsp;[Callback](../../apis-basic-services-kit/js-apis-base.md#callback)<[NavDestinationContext](#navdestinationcontext11)>)
322e41f4b71Sopenharmony_ci
323e41f4b71Sopenharmony_ci当NavDestination即将构建子组件之前会触发此回调。
324e41f4b71Sopenharmony_ci
325e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
326e41f4b71Sopenharmony_ci
327e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ci## NavDestinationCommonTitle
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
332e41f4b71Sopenharmony_ci
333e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
334e41f4b71Sopenharmony_ci
335e41f4b71Sopenharmony_ci| 名称   | 类型     | 必填   | 说明     |
336e41f4b71Sopenharmony_ci| ---- | ------ | ---- | ------ |
337e41f4b71Sopenharmony_ci| main | string \| [Resource<sup>14+<sup>](ts-types.md#resource) | 是    | 设置主标题。 |
338e41f4b71Sopenharmony_ci| sub  | string \| [Resource<sup>14+<sup>](ts-types.md#resource) | 是    | 设置副标题。 |
339e41f4b71Sopenharmony_ci
340e41f4b71Sopenharmony_ci## NavDestinationCustomTitle
341e41f4b71Sopenharmony_ci
342e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
345e41f4b71Sopenharmony_ci
346e41f4b71Sopenharmony_ci| 名称      | 类型                                       | 必填   | 说明       |
347e41f4b71Sopenharmony_ci| ------- | ---------------------------------------- | ---- | -------- |
348e41f4b71Sopenharmony_ci| builder | [CustomBuilder](ts-types.md#custombuilder8) | 是    | 设置标题栏内容。 |
349e41f4b71Sopenharmony_ci| height  | [TitleHeight](ts-appendix-enums.md#titleheight9) \| [Length](ts-types.md#length) | 是    | 设置标题栏高度。 |
350e41f4b71Sopenharmony_ci
351e41f4b71Sopenharmony_ci## NavDestinationContext<sup>11+</sup>
352e41f4b71Sopenharmony_ci
353e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_ci| 名称   | 类型     | 必填   |  说明     |
356e41f4b71Sopenharmony_ci| ---- | ------ | ----- | ------ |
357e41f4b71Sopenharmony_ci| pathInfo | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | 是 | 跳转NavDestination时指定的参数。 <br/>**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 |
358e41f4b71Sopenharmony_ci| pathStack  | [NavPathStack](ts-basic-components-navigation.md#navpathstack10) | 是 | 当前NavDestination所处的页面栈。 <br/>**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 |
359e41f4b71Sopenharmony_ci| navDestinationId<sup>12+</sup> | string | 否 | 当前NavDestination的唯一ID,由系统自动生成,和组件通用属性id无关。 <br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。|
360e41f4b71Sopenharmony_ci
361e41f4b71Sopenharmony_ci### getConfigInRouteMap<sup>12+</sup>
362e41f4b71Sopenharmony_ci
363e41f4b71Sopenharmony_cigetConfigInRouteMap(): RouteMapConfig |undefined
364e41f4b71Sopenharmony_ci
365e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
366e41f4b71Sopenharmony_ci
367e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
368e41f4b71Sopenharmony_ci
369e41f4b71Sopenharmony_ci**返回值**
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci| 类型 | 说明 |
372e41f4b71Sopenharmony_ci| --- | --- |
373e41f4b71Sopenharmony_ci| [RouteMapConfig](#routemapconfig12) | 当前页面路由配置信息。 |
374e41f4b71Sopenharmony_ci| undefined | 当该页面不是通过路由表配置时返回undefined。 |
375e41f4b71Sopenharmony_ci
376e41f4b71Sopenharmony_ci## RouteMapConfig<sup>12+</sup>
377e41f4b71Sopenharmony_ci
378e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
379e41f4b71Sopenharmony_ci
380e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
381e41f4b71Sopenharmony_ci
382e41f4b71Sopenharmony_ci| 名称   | 类型   |必填 | 说明 |
383e41f4b71Sopenharmony_ci| ----  | ---   | ---- |----- |
384e41f4b71Sopenharmony_ci| name  | string | 是 | 页面名称。|
385e41f4b71Sopenharmony_ci| pageSourceFile| string | 是 | 页面在当前包中的路径。|
386e41f4b71Sopenharmony_ci| data | Object | 是 | 页面自定义字段信息。|
387e41f4b71Sopenharmony_ci
388e41f4b71Sopenharmony_ci## 示例
389e41f4b71Sopenharmony_ci
390e41f4b71Sopenharmony_ciNavDestination用法可参考[Navigation示例](ts-basic-components-navigation.md#示例1)。
391