From e081972b1e11b1c1038040c53d85e7a6d7a625c7 Mon Sep 17 00:00:00 2001 From: wangxiuxiu96 Date: Mon, 8 Sep 2025 10:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=A1=86=E6=9E=B6=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=96=87=E6=9C=AC=E8=BE=93=E5=85=A5=E7=9B=91=E5=90=AC?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangxiuxiu96 --- api/@ohos.arkui.UIContext.d.ts | 53 ++++++++++++++++++++++++++++++++++ api/@ohos.arkui.observer.d.ts | 43 +++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/api/@ohos.arkui.UIContext.d.ts b/api/@ohos.arkui.UIContext.d.ts index 9278165b5b..90aee127e4 100644 --- a/api/@ohos.arkui.UIContext.d.ts +++ b/api/@ohos.arkui.UIContext.d.ts @@ -2533,6 +2533,59 @@ export declare class UIObserver { */ off(type: 'nodeRenderState', nodeIdentity: NodeIdentity, callback?: NodeRenderStateChangeCallback): void; + /** + * Registers a callback function to be called when text field's content is changed. + * + * @param { 'textChange' } type - The type of event to listen for. Must be 'textChange'. + * @param { Callback } callback - The callback function to be called when + * text field's content is changed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + on(type: 'textChange', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'textChange' } type - The type of event to remove the listener for. Must be 'textChange'. + * @param { Callback } [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 21 + */ + off(type: 'textChange', callback?: Callback): void; + + + /** + * Registers a callback function to be called when text field's content is changed. + * + * @param { 'textChange' } type - The type of event to listen for. Must be 'textChange'. + * @param { observer.ObserverOptions } observerOptions - Options. + * @param { Callback } callback - The callback function to be called when the + * text field's content is changed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + on(type: 'textChange', observerOptions: observer.ObserverOptions, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'textChange' } type - The type of event to remove the listener for. Must be 'textChange'. + * @param { observer.ObserverOptions } observerOptions - Options. + * @param { Callback } [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 21 + */ + off(type: 'textChange', observerOptions: observer.ObserverOptions, callback?: Callback): void; + /** * Registers a callback to monitor the gesture trigger information. * diff --git a/api/@ohos.arkui.observer.d.ts b/api/@ohos.arkui.observer.d.ts index dcc34ce776..ab6b6788d8 100644 --- a/api/@ohos.arkui.observer.d.ts +++ b/api/@ohos.arkui.observer.d.ts @@ -969,6 +969,49 @@ declare namespace uiObserver { operation: NavigationOperation; } + /** + * Text change event info + * + * @interface TextChangeEventInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + export interface TextChangeEventInfo { + /** + * The id of text input component. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + id: string; + + /** + * The uniqueId of the text input component. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + uniqueId: number; + /** + * Current content of text field component . + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + content: string; +} + /** * Indicates the options of NavDestination switch. * -- Gitee