From bb569c4a68d7998288002b707d2261c575dc8df1 Mon Sep 17 00:00:00 2001 From: leafly2021 Date: Thu, 12 Jan 2023 19:56:10 +0800 Subject: [PATCH] modify BaseContext link Signed-off-by: leafly2021 Change-Id: I47b5f5f684f7b4284b94506919112de26ef9d16f --- .../reference/apis/js-apis-window.md | 32 ++++++++----------- .../windowmanager/application-window-fa.md | 6 ++-- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md index fece859142..70e2b78548 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -54,7 +54,7 @@ import window from '@ohos.window'; | ---------- | -------------------------- | -- | ----------------------------------- | | name | string | 是 | 窗口名字。 | | windowType | [WindowType](#windowtype7) | 是 | 窗口类型。 | -| ctx | BaseContext | 否 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)。不设置,则默认为空。
当Context为[ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)时,创建系统窗口。 | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 否 | 当前应用上下文信息。不设置,则默认为空。
FA模型下不需要使用该参数,即可创建子窗口。
Stage模型下需要使用该参数,用于创建系统窗口。 | | displayId | number | 否 | 当前物理屏幕id。不设置,则默认为-1。 | | parentId | number | 否 | 父窗口id。不设置,则默认为-1。 | @@ -430,7 +430,7 @@ getLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | -- | ---------------------------------------- | -| ctx | BaseContext | 是 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[Context](js-apis-ability-context.md)。 | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 是 | 当前应用上下文信息。 | | callback | AsyncCallback<[Window](#window)> | 是 | 回调函数。返回当前应用内最后显示的窗口对象。 | **错误码:** @@ -472,7 +472,7 @@ getLastWindow(ctx: BaseContext): Promise<Window> | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | 是 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[Context](js-apis-ability-context.md)。 | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 是 | 当前应用上下文信息。 | **返回值:** @@ -897,9 +897,7 @@ promise.then((data)=> { create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback<Window>): void -创建子窗口,使用callback异步回调,其中Context详见[Context](js-apis-inner-app-context.md)。 - -从API version 9开始,当Context为[ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)时,创建系统窗口,使用callback异步回调。 +创建系统窗口,使用callback异步回调。 > **说明:** > @@ -909,12 +907,12 @@ create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback&l **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | 是 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)。 | -| id | string | 是 | 窗口id。 | -| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | -| callback | AsyncCallback<[Window](#window)> | 是 | 回调函数。返回当前创建的子窗口对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------- | ---- | ------------------------------------ | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 是 | 当前应用上下文信息。 | +| id | string | 是 | 窗口id。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | +| callback | AsyncCallback<[Window](#window)> | 是 | 回调函数。返回当前创建的子窗口对象。 | **示例:** @@ -935,9 +933,7 @@ window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT, create(ctx: BaseContext, id: string, type: WindowType): Promise<Window> -创建子窗口,使用Promise异步回调,其中Context详见[Context](js-apis-inner-app-context.md)。 - -从API version 9开始,当Context为[ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)时,创建系统窗口,使用Promise异步回调。 +创建系统窗口,使用Promise异步回调。 > **说明:** > @@ -949,7 +945,7 @@ create(ctx: BaseContext, id: string, type: WindowType): Promise<Window> | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------------------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | 是 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)。 | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 是 | 当前应用上下文信息。 | | id | string | 是 | 窗口id。 | | type | [WindowType](#windowtype7) | 是 | 窗口类型。 | @@ -1125,7 +1121,7 @@ getTopWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | 是 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[Context](js-apis-ability-context.md)。 | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 是 | 当前应用上下文信息。 | | callback | AsyncCallback<[Window](#window)> | 是 | 回调函数。返回当前应用内最后显示的窗口对象。 | **示例:** @@ -1158,7 +1154,7 @@ getTopWindow(ctx: BaseContext): Promise<Window> | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | 是 | 当前应用上下文信息。
FA模型的Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的Context定义见[Context](js-apis-ability-context.md)。 | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | 是 | 当前应用上下文信息。 | **返回值:** diff --git a/zh-cn/application-dev/windowmanager/application-window-fa.md b/zh-cn/application-dev/windowmanager/application-window-fa.md index a652a09d2b..53473d510d 100644 --- a/zh-cn/application-dev/windowmanager/application-window-fa.md +++ b/zh-cn/application-dev/windowmanager/application-window-fa.md @@ -54,7 +54,7 @@ let windowClass = null; // 方式一:创建子窗口。 - let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP, ctx: this.context}; + let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP}; window.createWindow(config, (err, data) => { if (err.code) { console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err)); @@ -72,8 +72,8 @@ console.info('Succeeded in finding subWindow. Data: ' + JSON.stringify(data)); windowClass = data; }); - ``` - +``` + 2. 设置子窗口属性。 子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。 -- GitLab