mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-02-08 01:37:35 +00:00
!11936 无感监听添加tabContentState的API
Merge pull request !11936 from 徐钦锋/TabContentStateAPI
This commit is contained in:
commit
4996c6064e
54
api/@ohos.arkui.UIContext.d.ts
vendored
54
api/@ohos.arkui.UIContext.d.ts
vendored
@ -1701,6 +1701,60 @@ export class UIObserver {
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'didClick', callback?: GestureEventListenerCallback): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the tabContent is showed or hidden.
|
||||
*
|
||||
* @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'.
|
||||
* @param { observer.ObserverOptions } options - The options object.
|
||||
* @param { Callback<observer.TabContentInfo> } callback - The callback function to be called
|
||||
* when the tabContent show or hide.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
on(type: 'tabContentUpdate', options: observer.ObserverOptions, callback: Callback<observer.TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'tabContentUpdate' } type - The type of event to remove the listener for. Must be 'tabContentUpdate'.
|
||||
* @param { observer.ObserverOptions } options - The options object.
|
||||
* @param { Callback<observer.TabContentInfo> } callback - The callback function to remove. If not provided,
|
||||
* all callbacks for the given event type and Tabs ID will be removed.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'tabContentUpdate', options: observer.ObserverOptions, callback?: Callback<observer.TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the tabContent is showed or hidden.
|
||||
*
|
||||
* @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'.
|
||||
* @param { Callback<observer.TabContentInfo> } callback - The callback function to be called
|
||||
* when the tabContent is showed or hidden.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
on(type: 'tabContentUpdate', callback: Callback<observer.TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'tabContentUpdate'} type - The type of event to remove the listener for. Must be 'tabContentUpdate'.
|
||||
* @param { Callback<observer.TabContentInfo> } callback - The callback function to remove. If not provided,
|
||||
* all callbacks for the given event type and Tabs ID will be removed.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'tabContentUpdate', callback?: Callback<observer.TabContentInfo>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
160
api/@ohos.arkui.observer.d.ts
vendored
160
api/@ohos.arkui.observer.d.ts
vendored
@ -311,6 +311,37 @@ declare namespace uiObserver {
|
||||
SCROLL_STOP = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* TabContent state.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export enum TabContentState {
|
||||
/**
|
||||
* When the TabContent hidden.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
ON_SHOW = 0,
|
||||
|
||||
/**
|
||||
* When the TabContent hidden.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
ON_HIDE = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* NavDestination info.
|
||||
*
|
||||
@ -508,6 +539,83 @@ declare namespace uiObserver {
|
||||
offset: number
|
||||
}
|
||||
|
||||
/**
|
||||
* TabContent info.
|
||||
*
|
||||
* @typedef TabContentInfo
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export interface TabContentInfo {
|
||||
/**
|
||||
* TabContent id.
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
tabContentId: string,
|
||||
|
||||
/**
|
||||
* TabContent uniqueId.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
tabContentUniqueId: number,
|
||||
|
||||
/**
|
||||
* The state of TabContent.
|
||||
*
|
||||
* @type { TabContentState }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
state: TabContentState,
|
||||
|
||||
/**
|
||||
* The index of TabContent in Tabs.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
index: number,
|
||||
|
||||
/**
|
||||
* Tabs id.
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
id: string,
|
||||
|
||||
/**
|
||||
* Tabs uniqueId.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
uniqueId: number
|
||||
}
|
||||
|
||||
/**
|
||||
* observer options.
|
||||
*
|
||||
@ -1035,6 +1143,58 @@ declare namespace uiObserver {
|
||||
*/
|
||||
export function off(type: 'didLayout', context: UIContext, callback?: Callback<void>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the tabContent is showed or hidden.
|
||||
*
|
||||
* @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'.
|
||||
* @param { ObserverOptions } options - The options object.
|
||||
* @param { Callback<TabContentInfo> } callback - The callback function to be called when when the tabContent is showed or hidden.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export function on(type: 'tabContentUpdate', options: ObserverOptions, callback: Callback<TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'tabContentUpdate' } type - The type of event to remove the listener for. Must be 'tabContentUpdate'.
|
||||
* @param { ObserverOptions } options - The options object.
|
||||
* @param { Callback<TabContentInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
|
||||
* Tabs ID will be removed.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export function off(type: 'tabContentUpdate', options: ObserverOptions, callback?: Callback<TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the tabContent is showed or hidden.
|
||||
*
|
||||
* @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'.
|
||||
* @param { Callback<TabContentInfo> } callback - The callback function to be called when the tabContent is showed or hidden.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export function on(type: 'tabContentUpdate', callback: Callback<TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'tabContentUpdate'} type - The type of event to remove the listener for. Must be 'tabContentUpdate'.
|
||||
* @param { Callback<TabContentInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
|
||||
* will be removed.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export function off(type: 'tabContentUpdate', callback?: Callback<TabContentInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the navigation switched to a new navDestination.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user