!11994 FrameNode支持查询Navigation/Router页面信息

Merge pull request !11994 from 向首兴/navRouter
This commit is contained in:
openharmony_ci 2024-06-13 06:56:18 +00:00 committed by Gitee
commit c6a227ff53
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1160,6 +1160,38 @@ declare type ClickEventListenerCallback = (event: ClickEvent, node?: FrameNode)
*/
declare type GestureEventListenerCallback = (event: GestureEvent, node?: FrameNode) => void;
/**
* Defines the PageInfo type.
* The value of routerPageInfo indicates the information of the router page, or undefined if the
* frameNode does not have router page information. And the value of navDestinationInfo indicates
* the information of the navDestination, or undefined if the frameNode does not have navDestination
* information.
*
* @interface PageInfo
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
export interface PageInfo {
/**
* the property of router page information.
*
* @type { ?observer.RouterPageInfo }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 12
*/
routerPageInfo?: observer.RouterPageInfo;
/**
* the property of navDestination information.
*
* @type { ?observer.NavDestinationInfo }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 12
*/
navDestinationInfo?: observer.NavDestinationInfo;
}
/**
* Register callbacks to observe ArkUI behavior.
*
@ -2643,6 +2675,33 @@ export class UIContext {
*/
getFrameNodeByUniqueId(id: number): FrameNode | null;
/**
* Get page information of the frameNode with uniqueId.
*
* @param { number } id - The uniqueId of the target FrameNode.
* @returns { PageInfo } - The page information of the frameNode with the target uniqueId, includes
* navDestination and router page information. If the frame node does not have navDestination and
* router page information, it will return an empty object.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
getPageInfoByUniqueId(id: number): PageInfo;
/**
* Get navigation information of the frameNode with uniqueId.
*
* @param { number } id - The uniqueId of the target FrameNode.
* @returns { observer.NavigationInfo | undefined } - The navigation information of the frameNode with the
* target uniqueId, or undefined if the frameNode is not existed or does not have navigation information.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
getNavigationInfoByUniqueId(id: number): observer.NavigationInfo | undefined;
/**
* Get FocusController.
* @returns { FocusController } the FocusController