diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md index af0bb8865dbb86539bd726d6136472c13f7c8599..415374ba79ad51ff1d7f85b40d4582e1aa2bf1f9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @@ -22,8 +22,8 @@ import data_preferences from '@ohos.data.preferences'; | 名称 | 参数类型 | 可读 | 可写 | 说明 | | ---------------- | -------- | ---- | ---- | --------------------------------------- | -| MAX_KEY_LENGTH | string | 是 | 否 | Key的最大长度限制,需小于80个字节。 | -| MAX_VALUE_LENGTH | string | 是 | 否 | Value的最大长度限制,需小于8192个字节。 | +| MAX_KEY_LENGTH | number | 是 | 否 | Key的最大长度限制,需小于80个字节。 | +| MAX_VALUE_LENGTH | number | 是 | 否 | Value的最大长度限制,需小于8192个字节。 | ## data_preferences.getPreferences diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md b/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md index 19648104db323d6f2c89f71ce52e027cf317e7c8..221f6ae908a9831104324c9579232c191e29595b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md @@ -124,7 +124,7 @@ goTo(offset:number): boolean ```js let predicatesgoto = new dataRdb.RdbPredicates("EMPLOYEE"); let promisequerygoto = rdbStore.query(predicatesgoto, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promisequerygoto.then((resultSet) { + promisequerygoto.then((resultSet) => { resultSet.goTo(1); resultSet.close(); }).catch((err) => { @@ -157,7 +157,7 @@ goToRow(position: number): boolean ```js let predicatesgotorow = new dataRdb.RdbPredicates("EMPLOYEE"); let promisequerygotorow = rdbStore.query(predicatesgotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promisequerygotorow.then((resultSet) { + promisequerygotorow.then((resultSet) => { resultSet.goToRow(5); resultSet.close(); }).catch((err) => { @@ -185,7 +185,7 @@ goToFirstRow(): boolean ```js let predicatesgoFirst = new dataRdb.RdbPredicates("EMPLOYEE"); let promisequerygoFirst = rdbStore.query(predicatesgoFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promisequerygoFirst.then((resultSet) { + promisequerygoFirst.then((resultSet) => { resultSet.goToFirstRow(); resultSet.close(); }).catch((err) => { @@ -212,7 +212,7 @@ goToLastRow(): boolean ```js let predicatesgoLast = new dataRdb.RdbPredicates("EMPLOYEE"); let promisequerygoLast = rdbStore.query(predicatesgoLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promisequerygoLast.then((resultSet) { + promisequerygoLast.then((resultSet) => { resultSet.goToLastRow(); resultSet.close(); }).catch((err) => { @@ -239,7 +239,7 @@ goToNextRow(): boolean ```js let predicatesgoNext = new dataRdb.RdbPredicates("EMPLOYEE"); let promisequerygoNext = rdbStore.query(predicatesgoNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promisequerygoNext.then((resultSet) { + promisequerygoNext.then((resultSet) => { resultSet.goToNextRow(); resultSet.close(); }).catch((err) => { @@ -266,7 +266,7 @@ goToPreviousRow(): boolean ```js let predicatesgoPrev = new dataRdb.RdbPredicates("EMPLOYEE"); let promisequerygoPrev = rdbStore.query(predicatesgoPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promisequerygoPrev.then((resultSet) { + promisequerygoPrev.then((resultSet) => { resultSet.goToPreviousRow(); resultSet.close(); }).catch((err) => { @@ -417,7 +417,7 @@ close(): void ```js let predicatesClose = new dataRdb.RdbPredicates("EMPLOYEE"); let promiseClose = rdbStore.query(predicatesClose, ["ID", "NAME", "AGE", "SALARY", "CODES"]); - promiseClose.then((resultSet) { + promiseClose.then((resultSet) => { resultSet.close(); }).catch((err) => { console.log('resultset close failed'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-storage.md b/zh-cn/application-dev/reference/apis/js-apis-data-storage.md index 2110b8065f4602a382bb1e1b339c9f968377239c..064669b6e3100d19ace8f95bb6656c96d598947d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-storage.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-storage.md @@ -24,8 +24,8 @@ import data_storage from '@ohos.data.storage'; | 名称 | 参数类型 | 可读 | 可写 | 说明 | | ---------------- | -------- | ---- | ---- | ------------------------------------- | -| MAX_KEY_LENGTH | string | 是 | 否 | key的最大长度限制,需小于80字节。 | -| MAX_VALUE_LENGTH | string | 是 | 否 | value的最大长度限制,需小于8192字节。 | +| MAX_KEY_LENGTH | number | 是 | 否 | key的最大长度限制,需小于80字节。 | +| MAX_VALUE_LENGTH | number | 是 | 否 | value的最大长度限制,需小于8192字节。 | ## data_storage.getStorageSync 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 e4c2b0fa72e6b3163cb96f289b28d61ff1f5c2cb..a34ad2a046f8bae71dcf5d81ff7cc5f4ec76c41f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -147,9 +147,9 @@ import window from '@ohos.window'; | 名称 | 参数类型 | 可读 | 可写 | 说明 | | --------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | -| type | [WindowType](#windowtype) | 是 | 否 | 当前属性改变的系统栏类型,仅支持类型为导航栏、状态栏的系统栏。 | +| type | [WindowType](#windowtype7) | 是 | 否 | 当前属性改变的系统栏类型,仅支持类型为导航栏、状态栏的系统栏。 | | isEnable | boolean | 是 | 否 | 当前系统栏是否显示。 | -| region | [Rect](#rect) | 是 | 否 | 当前系统栏的位置及大小。 | +| region | [Rect](#rect7) | 是 | 否 | 当前系统栏的位置及大小。 | | backgroundColor | string | 是 | 否 | 系统栏背景颜色,为十六进制RGB或ARGB颜色,不区分大小写,例如`#00FF00`或`#FF00FF00`。 | | contentColor | string | 是 | 否 | 系统栏文字颜色。 | @@ -188,10 +188,10 @@ import window from '@ohos.window'; | 名称 | 参数类型 | 可读 | 可写 | 说明 | | ---------- | ------------- | ---- | ---- | ------------------ | | visible9+ | boolean | 是 | 是 | 规避区域是否可见。 | -| leftRect | [Rect](#rect) | 是 | 是 | 屏幕左侧的矩形区。 | -| topRect | [Rect](#rect) | 是 | 是 | 屏幕顶部的矩形区。 | -| rightRect | [Rect](#rect) | 是 | 是 | 屏幕右侧的矩形区。 | -| bottomRect | [Rect](#rect) | 是 | 是 | 屏幕底部的矩形区。 | +| leftRect | [Rect](#rect7) | 是 | 是 | 屏幕左侧的矩形区。 | +| topRect | [Rect](#rect7) | 是 | 是 | 屏幕顶部的矩形区。 | +| rightRect | [Rect](#rect7) | 是 | 是 | 屏幕右侧的矩形区。 | +| bottomRect | [Rect](#rect7) | 是 | 是 | 屏幕底部的矩形区。 | ## Size7+ @@ -212,8 +212,8 @@ import window from '@ohos.window'; | 名称 | 参数类型 | 可读 | 可写 | 说明 | | ------------------------------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | -| windowRect7+ | [Rect](#rect) | 是 | 是 | 窗口尺寸。 | -| type7+ | [WindowType](#windowtype) | 是 | 是 | 窗口类型。 | +| windowRect7+ | [Rect](#rect7) | 是 | 是 | 窗口尺寸。 | +| type7+ | [WindowType](#windowtype7) | 是 | 是 | 窗口类型。 | | isFullScreen | boolean | 是 | 是 | 是否全屏,默认为false。 | | isLayoutFullScreen7+ | boolean | 是 | 是 | 窗口是否为沉浸式,默认为false。 | | focusable7+ | boolean | 是 | 否 | 窗口是否可聚焦,默认为true。 | @@ -297,7 +297,7 @@ create(id: string, type: WindowType, callback: AsyncCallback<Window>): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------ | | id | string | 是 | 窗口id。 | -| type | [WindowType](#windowtype) | 是 | 窗口类型。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | | callback | AsyncCallback<[Window](#window)> | 是 | 回调函数。返回当前创建的子窗口对象。 | **示例:** @@ -329,7 +329,7 @@ create(id: string, type: WindowType): Promise<Window> | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------------------- | ---- | ---------- | | id | string | 是 | 窗口id。 | -| type | [WindowType](#windowtype) | 是 | 窗口类型。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | **返回值:** @@ -366,7 +366,7 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback<Wi | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | ctx | Context | 是 | 当前应用上下文信息。
API version 8的Context定义见[Context](js-apis-Context.md)。
API version 9的Context定义见[Context](js-apis-service-extension-context.md)。 | | id | string | 是 | 窗口id。 | -| type | [WindowType](#windowtype) | 是 | 窗口类型。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | | callback | AsyncCallback<[Window](#window)> | 是 | 回调函数。返回当前创建的子窗口对象。 | **示例:** @@ -400,7 +400,7 @@ create(ctx: Context, id: string, type: WindowType): Promise<Window> | ------ | ------------------------- | ---- | ------------------------------------------------------------ | | ctx | Context | 是 | 当前应用上下文信息。
API version 8的Context定义见[Context](js-apis-Context.md)。
API version 9的Context定义见[Context](js-apis-service-extension-context.md)。 | | id | string | 是 | 窗口id。 | -| type | [WindowType](#windowtype) | 是 | 窗口类型。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | **返回值:** @@ -808,7 +808,7 @@ on(type: 'systemBarTintChange', callback: Callback<SystemBarTintState>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 监听事件,固定为'systemBarTintChange',即导航栏、状态栏属性变化事件。 | -| callback | Callback<[SystemBarTintState](#systembartintstate)> | 是 | 回调函数。返回当前的状态栏、导航栏信息集合。 | +| callback | Callback<[SystemBarTintState](#systembartintstate8)> | 是 | 回调函数。返回当前的状态栏、导航栏信息集合。 | **示例:** @@ -833,7 +833,7 @@ off(type: 'systemBarTintChange', callback?: Callback<SystemBarTintState >) | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 监听事件,固定为'systemBarTintChange',即导航栏、状态栏属性变化事件。 | -| callback | Callback<[SystemBarTintState](#systembartintstate)> | 否 | 回调函数。返回当前的状态栏、导航栏信息集合。 | +| callback | Callback<[SystemBarTintState](#systembartintstate8)> | 否 | 回调函数。返回当前的状态栏、导航栏信息集合。 | **示例:** @@ -1181,6 +1181,10 @@ resetSize(width: number, height: number, callback: AsyncCallback<void>): v 改变当前窗口大小,使用callback异步回调。 +应用主窗口与子窗口存在大小限制,宽度范围:[320,2560],高度范围:[240,2560],单位为vp。 + +系统窗口存在大小限制,宽度范围:[0,2560],高度范围:[0,2560],单位为vp。 + **系统能力:** SystemCapability.WindowManager.WindowManager.Core **参数:** @@ -1209,6 +1213,10 @@ resetSize(width: number, height: number): Promise<void> 改变当前窗口大小,使用Promise异步回调。 +应用主窗口与子窗口存在大小限制,宽度范围:[320,2560],高度范围:[240,2560],单位为vp。 + +系统窗口存在大小限制,宽度范围:[0,2560],高度范围:[0,2560],单位为vp。 + **系统能力:** SystemCapability.WindowManager.WindowManager.Core **参数:** @@ -1253,7 +1261,7 @@ setWindowType(type: WindowType, callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------- | -| type | [WindowType](#windowtype) | 是 | 窗口类型。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例:** @@ -1287,7 +1295,7 @@ setWindowType(type: WindowType): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------------------- | ---- | ---------- | -| type | [WindowType](#windowtype) | 是 | 窗口类型。 | +| type | [WindowType](#windowtype7) | 是 | 窗口类型。 | **返回值:** diff --git a/zh-cn/application-dev/reference/native-apis/_drawing.md b/zh-cn/application-dev/reference/native-apis/_drawing.md index 9c9772d11d13c346cd19d1d5473f51b3e49d571c..64ce6a9a7ec1cf306fbe9647082038f249ea21b5 100644 --- a/zh-cn/application-dev/reference/native-apis/_drawing.md +++ b/zh-cn/application-dev/reference/native-apis/_drawing.md @@ -2154,7 +2154,7 @@ void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle * , int , const c | -------- | -------- | | OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | | int | 字体名称数量 | -| char | 指向字体类型的指针 | +| fontFamilies | 指向字体类型的指针数组 | **自从:** diff --git a/zh-cn/application-dev/windowmanager/application-window-fa.md b/zh-cn/application-dev/windowmanager/application-window-fa.md index aa71125a54912afbbd39c8537376c31b893d5f07..968540c91ddbf38ebc9ce853cb8a7dbe603a0568 100644 --- a/zh-cn/application-dev/windowmanager/application-window-fa.md +++ b/zh-cn/application-dev/windowmanager/application-window-fa.md @@ -27,7 +27,7 @@ | window静态方法 | find(id: string, callback: AsyncCallback<Window>): void | 查找`id`所对应的窗口。 | | Window | loadContent(path: string, callback: AsyncCallback<void>): void | 为当前窗口加载具体页面内容。 | | Window | moveTo(x: number, y: number, callback: AsyncCallback<void>): void | 移动当前窗口。 | -| Window | setBackgroundColor(color: string, callback: AsyncCallback<void>): void | 设置窗口的背景色 | +| Window | setBackgroundColor(color: string, callback: AsyncCallback<void>): void | 设置窗口的背景色。 | | Window | setBrightness(brightness: number, callback: AsyncCallback<void>): void | 设置屏幕亮度值。 | | Window | resetSize(width: number, height: number, callback: AsyncCallback<void>): void | 改变当前窗口大小。 | | Window | setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void | 设置窗口是否全屏显示。 | @@ -136,16 +136,13 @@ 当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用`destroy`接口销毁子窗口。 ```js - // 销毁子窗口。当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用destroy接口销毁子窗口,此处以监听窗口区域外的点击事件实现子窗口的销毁。 - windowClass.on('touchOutside', () => { - console.info('touch outside'); - windowClass.destroy((err, data) => { - if (err.code) { - console.error('Failed to destroy the subwindow. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in destroying the subwindow. Data: ' + JSON.stringify(data)); - }); + // 销毁子窗口。当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用destroy接口销毁子窗口。 + windowClass.destroy((err, data) => { + if (err.code) { + console.error('Failed to destroy the subwindow. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in destroying the subwindow. Data: ' + JSON.stringify(data)); }); ``` @@ -169,7 +166,7 @@ import window from '@ohos.window'; let mainWindowClass = null; - // 获取主窗口 + // 获取主窗口。 window.getTopWindow((err, data) => { if (err.code) { console.error('Failed to get the subWindow. Cause: ' + JSON.stringify(err)); @@ -218,10 +215,7 @@ let sysBarProps = { statusBarColor: '#ff00ff', navigationBarColor: '#00ff00', - // 以下两个属性从API Version7开始支持 - isStatusBarLightIcon: false, - isNavigationBarLightIcon: false, - // 以下两个属性从API Version8开始支持 + // 以下两个属性从API Version8开始支持。 statusBarContentColor: '#ffffff', navigationBarContentColor: '#ffffff' }; diff --git a/zh-cn/application-dev/windowmanager/application-window-stage.md b/zh-cn/application-dev/windowmanager/application-window-stage.md index aa074d4714e12901ebd5c57cf0d64f16cc449616..1cb4e281f1c78336a50df42cbe79e1e5b7f120f0 100644 --- a/zh-cn/application-dev/windowmanager/application-window-stage.md +++ b/zh-cn/application-dev/windowmanager/application-window-stage.md @@ -127,11 +127,12 @@ class MainAbility extends Ability { ```ts import Ability from '@ohos.application.Ability' + let windowStage_ = null; + let sub_windowClass = null; class MainAbility extends Ability { - onWindowStageCreate(windowStage) { + showSubWindow() { // 1.创建应用子窗口。 - let sub_windowClass = null; - windowStage.createSubWindow("mySubWindow", (err, data) => { + windowStage_.createSubWindow("mySubWindow", (err, data) => { if (err.code) { console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err)); return; @@ -139,7 +140,7 @@ class MainAbility extends Ability { sub_windowClass = data; console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data)); // 1.获取已创建的应用子窗口。 - windowStage.getSubWindow((err, data) => { + windowStage_.getSubWindow((err, data) => { if (err.code) { console.error('Failed to obtain the subWindow. Cause:' + JSON.stringify(err)); return; @@ -178,16 +179,30 @@ class MainAbility extends Ability { console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); }); }); - // 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁。 - sub_windowClass.destroy((err, data) => { - if (err.code) { - console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err)); - return; - } - console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data)); - }); }) } + + destroySubWindow() { + // 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁。 + sub_windowClass.destroy((err, data) => { + if (err.code) { + console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageCreate(windowStage) { + windowStage_ = windowStage; + // 开发者可以在适当的时机,如主窗口上按钮点击事件等,创建子窗口。并不一定需要在onWindowStageCreate调用,这里仅作展示 + this.showSubWindow(); + } + + onWindowStageDestroy() { + // 开发者可以在适当的时机,如子窗口上点击关闭按钮等,销毁子窗口。并不一定需要在onWindowStageDestroy调用,这里仅作展示 + this.destroySubWindow(); + } }; ``` @@ -255,9 +270,6 @@ class MainAbility extends Ability { let sysBarProps = { statusBarColor: '#ff00ff', navigationBarColor: '#00ff00', - // 以下两个属性从API Version 7开始支持 - isStatusBarLightIcon: false, - isNavigationBarLightIcon: false, // 以下两个属性从API Version 8开始支持 statusBarContentColor: '#ffffff', navigationBarContentColor: '#ffffff' diff --git a/zh-cn/application-dev/windowmanager/window-overview.md b/zh-cn/application-dev/windowmanager/window-overview.md index 40d122f4bb00a706739c186d14f4cf5e4b8c5160..fbd5d7083df207d5dce417100beb074066454f30 100644 --- a/zh-cn/application-dev/windowmanager/window-overview.md +++ b/zh-cn/application-dev/windowmanager/window-overview.md @@ -65,4 +65,8 @@ OpenHarmony的窗口模块将窗口界面分为系统窗口、应用窗口两种 ## 约束与限制 -在FA模型下,不支持系统窗口的相关开发。 +- 在FA模型下,不支持系统窗口的相关开发。 + +- 应用主窗口与子窗口存在大小限制,宽度范围:[320, 2560],高度范围:[240, 2560],单位为vp。 + +- 系统窗口存在大小限制,宽度范围:[0, 2560],高度范围:[0, 2560],单位为vp。