diff --git a/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md b/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md index 08c387a15dcd0581c2eb6a5f30522ae9da392a4e..3a08b7c244d07db9ce87bfb28fef11600067da38 100644 --- a/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md +++ b/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md @@ -58,26 +58,15 @@ struct ComponentA { this.label = (this.languageCode === 'zh') ? '数量' : 'Count' }) } - .margin({ bottom: 50 }) + .margin({ top: 50, bottom: 50 }) Row() { Button(`更改@StorageLink修饰的变量:${this.varA}`).height(40).fontSize(14) .onClick(() => { this.varA++ }) - }.margin({ bottom: 50 }) - - Row() { - Button(`更改@StorageProp修饰的变量:${this.languageCode}`).height(40).fontSize(14) - .onClick(() => { - if (this.languageCode === 'zh') { - this.languageCode = 'en' - } else { - this.languageCode = 'zh' - } - }) } - } + }.width('100%') } } ``` diff --git a/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md b/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md index c984324d66f335212b2256c4162abfe38f22e1d8..aeb1abc5de1ddff32f6217345d761bf89ba7395e 100644 --- a/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md +++ b/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md @@ -15,8 +15,8 @@ ArkTS提供了多维度的状态管理机制,在ArkUI开发框架中,和UI | @Link | 基本数据类型,类,数组 | 父子组件之间的双向数据绑定,父组件的内部状态数据作为数据源,任何一方所做的修改都会反映给另一方。 | | @Observed | 类 | @Observed应用于类,表示该类中的数据变更被UI页面管理。 | | @ObjectLink | 被@Observed所装饰类的对象 | @ObjectLink装饰的状态数据被修改时,在父组件或者其他兄弟组件内与它关联的状态数据所在的组件都会重新渲染。 | -| @Consume | 基本数据类型,类,数组 | @Consume装饰的变量在感知到@Provide装饰的变量更新后,会触发当前自定义组件的重新渲染。 | | @Provide | 基本数据类型,类,数组 | @Provide作为数据的提供方,可以更新其子孙节点的数据,并触发页面重新渲染。 | +| @Consume | 基本数据类型,类,数组 | @Consume装饰的变量在感知到@Provide装饰的变量更新后,会触发当前自定义组件的重新渲染。 | ## 应用级变量的状态管理 @@ -25,6 +25,9 @@ AppStorage是整个应用程序状态的中心“数据库”,UI框架会针 - @StorageLink:@StorageLink(name)的原理类似于@Consume(name),不同的是,该给定名称的链接对象是从AppStorage中获得的,在UI组件和AppStorage之间建立双向绑定同步数据。 - @StorageProp:@StorageProp(name)将UI组件数据与AppStorage进行单向同步,AppStorage中值的更改会更新UI组件中的数据,但UI组件无法更改AppStorage中的数据。 - AppStorage还提供了用于业务逻辑实现的API,用于添加、读取、修改和删除应用程序的状态数据,此API所做的更改会导致修改的状态数据同步到UI组件上进行UI更新。 +- LocalStorage是应用程序中每一个Ability的存储器。 +- @LocalStorageLink:组件通过使用@LocalStorageLink(key)装饰的状态变量,key值为LocalStorage中的属性键值,与LocalStorage建立双向数据绑定。 +- @LocalStorageProp:组件通过使用@LocalStorageProp(key)装饰的状态变量,key值为LocalStorage中的属性键值,与LocalStorage建立单向数据绑定。 - PersistentStorage提供了一些静态方法用来管理应用持久化数据,可以将特定标记的持久化数据链接到AppStorage中,并由AppStorage接口访问对应持久化数据,或者通过@StorageLink装饰器来访问对应key的变量。 - Environment是框架在应用程序启动时创建的单例对象,它为AppStorage提供了一系列应用程序需要的环境状态数据,这些数据描述了应用程序运行的设备环境。 diff --git a/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md b/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md index b6c500147ed72851e07edab9f56236ca39129455..d69948b247444c57f39dfb6d6402d4423e244e9a 100644 --- a/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md +++ b/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md @@ -152,7 +152,7 @@ struct CountDownComponent { - 支持多种类型:@Link支持的数据类型与@State相同,即class、number、string、boolean或这些类型的数组; - 私有:仅支持组件内访问; -- 单个数据源:父组件中用于初始化子组件@Link变量的必须是@State变量; +- 单个数据源:父组件中用于初始化子组件@Link变量的必须是父组件定义的状态变量; - 双向通信:子组件对@Link变量的更改将同步修改父组件中的@State变量; - 创建自定义组件时需要将变量的引用传递给@Link变量,在创建组件的新实例时,必须使用命名参数初始化所有@Link变量。@Link变量可以使用@State变量或@Link变量的引用进行初始化,@State变量可以通过`'$'`操作符创建引用。 @@ -391,7 +391,7 @@ struct ViewB { ``` -## @Consume和@Provide +## @Provide和@Consume @Provide作为数据的提供方,可以更新其子孙节点的数据,并触发页面渲染。@Consume在感知到@Provide数据的更新后,会触发当前自定义组件的重新渲染。 diff --git a/zh-cn/application-dev/quick-start/figures/appstorage.gif b/zh-cn/application-dev/quick-start/figures/appstorage.gif index 74fb655faba656a8542c8b8dd1619c307565dbac..28fcc0d5d0b4a674aa9c876a0e373fe01d9ab8b0 100644 Binary files a/zh-cn/application-dev/quick-start/figures/appstorage.gif and b/zh-cn/application-dev/quick-start/figures/appstorage.gif differ diff --git a/zh-cn/application-dev/quick-start/multi-hap-release-deployment.md b/zh-cn/application-dev/quick-start/multi-hap-release-deployment.md index 755009c273442c1579296bce884bb88cb3e63e6b..312c914cfaa6bb70c48502c7915e8c79af7cff07 100644 --- a/zh-cn/application-dev/quick-start/multi-hap-release-deployment.md +++ b/zh-cn/application-dev/quick-start/multi-hap-release-deployment.md @@ -1,42 +1,51 @@ # 多HAP的开发调试与发布部署流程 +多HAP的开发调试与发布部署流程如下图所示。 -## 1. 开发 +**图1** 多HAP的开发调试与发布部署流程 +![hap-release](figures/hap-release.png) + +## 开发 开发者通过[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio)工具按照业务的需要创建多个Module,在相应的Module中完成自身业务的开发。 -## 2. 调试 -通过DevEco Studio编译打包,生成单个或者多个HAP包。真机基于HAP包进行安装、卸载调试,调试指南可参考[应用程序包调试方法](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-debugging-and-running-0000001263040487#section10491183521520),其中包括了单HAP与多HAP通过DevEco Studio工具的安装调试方法。 - -应用程序包也可以通过[hdc_std工具](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md)(可通过OpenHarmony SDK获取,在SDK的toolchains目录下)进行安装、更新与卸载,通过hdc_std安装HAP时,HAP的路径为开发平台上的文件路径,以Windows开发平台为例,命令参考如下: -``` -// 安装、更新,多HAP可以指定多个文件路径 -hdc_std install C:\entry.hap C:\feature.hap -// 执行结果 -install bundle successfully. -// 卸载 -hdc_std uninstall com.example.myapplication -// 执行结果 -uninstall bundle successfully. -``` -应用程序包也可以通过[bm工具](../../application-dev/tools/bm-tool.md)进行调试。通过bm工具进行安装、更新HAP时,传入的文件路径为真机上的文件路径,命令参考如下: -``` -// 安装、更新,多HAP可以指定多个文件路径 -bm install -p /data/app/entry.hap /data/app/feature.hap -// 执行结果 -install bundle successfully. -// 卸载 -bm uninstall -n com.example.myapplication -// 执行结果 -uninstall bundle successfully. -``` -## 3. 发布 +## 调试 +通过DevEco Studio编译打包,生成单个或者多个HAP,即可基于HAP进行调试。 +* 使用DevEco Studio进行调试 + + 使用指导可参考[应用程序包调试方法](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-debugging-and-running-0000001263040487#section10491183521520),其中包括了单HAP与多HAP通过DevEco Studio工具的安装调试方法。 + +* 使用[hdc_std工具](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md)(可通过OpenHarmony SDK获取,在SDK的toolchains目录下)进行调试 + + 使用hdc_std安装HAP时,HAP的路径为开发平台上的文件路径,以Windows开发平台为例,命令参考如下: + ``` + // 安装、更新,多HAP可以指定多个文件路径 + hdc_std install C:\entry.hap C:\feature.hap + // 执行结果 + install bundle successfully. + // 卸载 + hdc_std uninstall com.example.myapplication + // 执行结果 + uninstall bundle successfully. + ``` + +* 使用[bm工具](../../application-dev/tools/bm-tool.md)进行调试 + + 使用bm工具进行安装、更新HAP时,传入的文件路径为真机上 的文件路径,命令参考如下: + ``` + // 安装、更新,多HAP可以指定多个文件路径 + bm install -p /data/app/entry.hap /data/app/ feature.hap + // 执行结果 + install bundle successfully. + // 卸载 + bm uninstall -n com.example.myapplication + // 执行结果 + uninstall bundle successfully. + ``` +## 发布 当开发的程序包满足发布要求时,可以在工具中打包编译生成App包。将该App包上架到应用市场云端,应用市场会对上架的App包校验签名,校验签名通过后会将App包中的HAP拆分出来,同时对拆分出的HAP重新添加签名,然后对HAP进行分发。 -## 4. 部署 +## 部署 用户在设备上的应用市场客户端能够看到各种各样的应用,这些应用均由云端分发而来,有些是多HAP应用,有些是单HAP应用。用户选择某个应用后,应用市场将下载应用包含的全部HAP。 -## 5. 应用在终端设备上的安装 +## 应用在终端设备上的安装 下载完成后,应用市场客户端再调用系统中包管理服务的安装接口安装下载的HAP,包管理服务以应用为单位将其中所有HAP部署到指定目录下,以完成应用的安装。 - - **图1** 多HAP的开发调试与发布部署流程  -![hap-release](figures/hap-release.png) diff --git a/zh-cn/application-dev/reference/apis/js-apis-animator.md b/zh-cn/application-dev/reference/apis/js-apis-animator.md index 138f7392800e8530bb7c18cd83246232a6db5257..5e7d5ef70bb5341dfe3b58c88cb569e08db42ed7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-animator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-animator.md @@ -40,10 +40,10 @@ create(options: AnimatorOptions): AnimatorResult easing: 'friction', delay: 0, fill: 'forwards', - direction: "normal", + direction: 'normal', iterations: 3, begin: 200.0, - end: 400.0, + end: 400.0 }; animator.create(options); ``` @@ -83,10 +83,10 @@ let options = { easing: 'friction', delay: 0, fill: 'forwards', - direction: "normal", + direction: 'normal', iterations: 3, begin: 200.0, - end: 400.0, + end: 400.0 }; try { animator.reset(options); @@ -296,10 +296,10 @@ export default { easing: 'friction', delay: 0, fill: 'forwards', - direction: "normal", + direction: 'normal', iterations: 2, begin: 0, - end: 400.0, + end: 400.0 }; try { this.animator.reset(options1); @@ -516,10 +516,10 @@ let options = { easing: 'friction', delay: 0, fill: 'forwards', - direction: "normal", + direction: 'normal', iterations: 3, begin: 200.0, - end: 400.0, + end: 400.0 }; this.animator = animator.createAnimator(options); ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md index 49e2ec26612ff745fb16d42a6e87aeb719ab6c43..4ae45a7b2dd6f0e365d77c6d15374aa0c76e2666 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md @@ -17,6 +17,26 @@ import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility' ``` +## uri命名规则 + +标准uri定义结构如下: + +**Scheme://authority/path** +- Scheme: 协议名,对于data share统一为datashare +- authority: [userinfo@]host[:port] + - userinfo: 登录信息,不需要填写。 + - host: 服务器地址,如果跨设备访问则为目标设备的ID,如果为本设备则为空。 + - port: 服务器端口,不需要填写。 +- path: data share的标识信息和资源的路径信息,需要包含data share的标识信息,资源的路径信息可以不填写。 + +uri示例: + +- 不包含资源路径: `datashare:///com.samples.datasharetest.DataShare` + +- 包含资源路径: `datashare:///com.samples.datasharetest.DataShare/DB00/TBL00` + +其中,data share的标识信息为`com.samples.datasharetest.DataShare`,资源路径为`DB00/TBL00`。 + ## 属性 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Provider diff --git a/zh-cn/application-dev/reference/apis/js-apis-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md index f87cfa52bd00bbf1232f8c3db137dce63a763693..04688626a34755ce9c12562a7180c5b4b7db8e0a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-curve.md +++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md @@ -327,7 +327,7 @@ struct ImageComponent { this.widthSize = curve.interpolate(0.5) * this.widthSize; this.heightSize = curve.interpolate(0.5) * this.heightSize; }) - .animation({duration: 2000 , curve: Curves.stepsCurve(9, true)}) + .animation({ duration: 2000 , curve: Curves.stepsCurve(9, true) }) }.width("100%").height("100%") } } diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md index 642917d479da502c4bda722829c5872e49675ec0..108c56317112cfdb270724569c6926c1e10f8004 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md @@ -17,6 +17,25 @@ import dataShare from '@ohos.data.dataShare' ``` +## uri命名规则 + +标准uri定义结构如下: + +**Scheme://authority/path** +- Scheme: 协议名,对于data share统一为datashare +- authority: [userinfo@]host[:port] + - userinfo: 登录信息,不需要填写。 + - host: 服务器地址,如果跨设备访问则为目标设备的ID,如果为本设备则为空。 + - port: 服务器端口,不需要填写。 +- path: data share的标识信息和资源的路径信息,需要包含data share的标识信息,资源的路径信息可以不填写。 + +uri示例: + +- 不包含资源路径: `datashare:///com.samples.datasharetest.DataShare` + +- 包含资源路径: `datashare:///com.samples.datasharetest.DataShare/DB00/TBL00` + +其中,data share的标识信息为`com.samples.datasharetest.DataShare`,资源路径为`DB00/TBL00`。 ## dataShare.createDataShareHelper diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md index 71087082bb45c118b9243d8eea0c5c2e31876246..a62b3e2d0f7970d72b8f660585911a4b0bb226e0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -92,11 +92,11 @@ save接口回调信息。 **系统能力:** SystemCapability.DistributedDataManager.DataObject.DistributedObject -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| sessionId | string | 多设备协同的唯一标识。 | -| version | number |已保存对象的版本。 | -| deviceId | string | 存储数据的设备号,标识需要保存对象的设备。默认为"local",标识本地设备;可自定义设置其他标识设备的字符串。 | +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| sessionId | string | 是 | 多设备协同的唯一标识。 | +| version | number | 是 | 已保存对象的版本。 | +| deviceId | string | 是 | 存储数据的设备号,标识需要保存对象的设备。默认为"local",标识本地设备;可自定义设置其他标识设备的字符串。 | ## RevokeSaveSuccessResponse9+ @@ -104,9 +104,9 @@ revokeSave接口回调信息。 **系统能力:** SystemCapability.DistributedDataManager.DataObject.DistributedObject -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| sessionId | string | 多设备协同的唯一标识。 | +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| sessionId | string | 是 | 多设备协同的唯一标识。 | ## DistributedObjectV9 diff --git a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md index bbf10b7c69416c5e1b58ac933b000f0fe7f6d9b0..bd45815101ffa3a86a7f6645e0d5ce59b1563ba4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md +++ b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md @@ -148,8 +148,8 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private matrix1 = matrix4.identity().translate({x:100}) - private matrix2 = this.matrix1.copy().scale({x:2}) + private matrix1 = matrix4.identity().translate({ x: 100 }) + private matrix2 = this.matrix1.copy().scale({ x: 2 }) build() { Column() { @@ -160,7 +160,7 @@ struct Test { Image($r("app.media.bg2")) .width("40%") .height(100) - .margin({top:50}) + .margin({ top: 50 }) .transform(this.matrix2) } } @@ -202,8 +202,8 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private matrix1 = matrix4.identity().translate({x:200}).copy() - private matrix2 = matrix4.identity().scale({x:2}).copy() + private matrix1 = matrix4.identity().translate({ x: 200 }).copy() + private matrix2 = matrix4.identity().scale({ x: 2 }).copy() build() { Column() { @@ -211,13 +211,13 @@ struct Test { Image($r("app.media.icon")) .width("40%") .height(100) - .margin({top:50}) + .margin({ top: 50 }) // 先平移x轴200px,再缩放两倍x轴,得到矩阵变换后的效果图 Image($r("app.media.icon")) .transform(this.matrix1.combine(this.matrix2)) .width("40%") .height(100) - .margin({top:50}) + .margin({ top: 50 }) } } } @@ -245,7 +245,7 @@ Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效 ```ts import matrix4 from '@ohos.matrix4' // matrix1(宽放大2倍) 和 matrix2(宽缩小2倍) 效果相反 -let matrix1 = matrix4.identity().scale({x:2}) +let matrix1 = matrix4.identity().scale({ x: 2 }) let matrix2 = matrix1.invert() @Entry @Component @@ -298,7 +298,7 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private matrix1 = matrix4.identity().translate({x:100, y:200, z:30}) + private matrix1 = matrix4.identity().translate({ x: 100, y: 200, z: 30 }) build() { Column() { @@ -346,7 +346,7 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private matrix1 = matrix4.identity().scale({x:2, y:3, z:4, centerX:50, centerY:50}) + private matrix1 = matrix4.identity().scale({ x:2, y:3, z:4, centerX:50, centerY:50 }) build() { Column() { @@ -395,14 +395,14 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private matrix1 = matrix4.identity().rotate({x:1, y:1, z:2, angle:30}) + private matrix1 = matrix4.identity().rotate({ x: 1, y: 1, z: 2, angle: 30 }) build() { Column() { Image($r("app.media.bg1")).transform(this.matrix1) .width("40%") .height(100) - }.width("100%").margin({top:50}) + }.width("100%").margin({ top: 50 }) } } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-router.md b/zh-cn/application-dev/reference/apis/js-apis-router.md index 607bf89cf8aff6bb287a87414faa98c5290ebee3..49150244b3f00c85c743b875878183efe9dab971 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -571,9 +571,9 @@ getParams(): Object **返回值:** -| 类型 | 说明 | -| ------ | ----------------- | -| Object | 发起跳转的页面往当前页传入的参数。 | +| 类型 | 说明 | +| ------ | ---------------------------------- | +| object | 发起跳转的页面往当前页传入的参数。 | **示例:** @@ -653,7 +653,7 @@ struct Index { } } try { - await router.push(options) + await router.pushUrl(options) } catch (err) { console.info(` fail callback, code: ${err.code}, msg: ${err.msg}`) } @@ -661,18 +661,18 @@ struct Index { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('这是第一页') - .fontSize(50) - .fontWeight(FontWeight.Bold) + Text('这是第一页') + .fontSize(50) + .fontWeight(FontWeight.Bold) Button() { Text('next page') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) - .margin({ top: 20 }) - .backgroundColor('#ccc') - .onClick(() => { - this.routePage() + .margin({ top: 20 }) + .backgroundColor('#ccc') + .onClick(() => { + this.routePage() }) } .width('100%') @@ -704,7 +704,7 @@ struct Second { this.secondData = (this.data.array[1]).toString() }) .margin({top:20}) - Text('第一页传来的数值' + ' ' + this.secondData) + Text(`第一页传来的数值:${this.secondData}`) .fontSize(20) .margin({top:20}) .backgroundColor('red') diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md index 6a3f6c25fb4b703df432ba81243ea19ad1726255..32b8ee14abf384ba1ca27dc7c2358e1d60553da3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md @@ -12,7 +12,7 @@ ## 导入模块 -``` +```ts import mediaquery from '@system.mediaquery'; ``` @@ -39,8 +39,8 @@ matchMedia(condition: string): MediaQueryList **示例:** -``` -var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); +```ts +let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); ``` ## MediaQueryEvent @@ -97,7 +97,7 @@ addListener(callback: (event: MediaQueryEvent) => void): void **示例:** -``` +```ts function maxWidthMatch(e){ if(e.matches){ // do something @@ -123,7 +123,7 @@ removeListener(callback: (event: MediaQueryEvent) => void): void **示例:** -``` +```ts function maxWidthMatch(e){ if(e.matches){ // do something diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-router.md b/zh-cn/application-dev/reference/apis/js-apis-system-router.md index 1c4cf633e8dacc1000b2ddac850a801b430432d2..8315ee5c1a6505c59e19d35ae383dfe892d98d1c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-router.md @@ -43,8 +43,8 @@ export default { data1: 'message', data2: { data3: [123, 456, 789] - }, - }, + } + } }); } } @@ -94,8 +94,8 @@ export default { router.replace({ uri: 'pages/detail/detail', params: { - data1: 'message', - }, + data1: 'message' + } }); } } @@ -135,7 +135,7 @@ back(options?: BackRouterOptions): void export default { indexPushPage() { router.push({ - uri: 'pages/detail/detail', + uri: 'pages/detail/detail' }); } } @@ -147,7 +147,7 @@ export default { export default { detailPushPage() { router.push({ - uri: 'pages/mall/mall', + uri: 'pages/mall/mall' }); } } @@ -237,7 +237,7 @@ getLength(): string ```js export default { getLength() { - var size = router.getLength(); + let size = router.getLength(); console.log('pages stack size = ' + size); } } @@ -262,7 +262,7 @@ getState(): RouterState ```js export default { getState() { - var page = router.getState(); + let page = router.getState(); console.log('current index = ' + page.index); console.log('current name = ' + page.name); console.log('current path = ' + page.path); @@ -296,7 +296,7 @@ export default { }, cancel: function() { console.log('cancel'); - }, + } }); } } @@ -327,7 +327,7 @@ export default { }, cancel: function() { console.log('cancel'); - }, + } }); } } @@ -339,10 +339,10 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite -| 名称 | 参数类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------------------------------- | -| uri | string | 是 | 目标页面的uri,可以是以下的两种格式:
1. 页面的绝对路径,由config.json文件中的页面列表提供。例如:
- pages/index/index
-pages/detail/detail
2. 特定路径。如果URI为斜杠(/),则显示主页。 | -| params | Object | 否 | 表示路由跳转时要同时传递到目标页面的数据。跳转到目标页面后,使用router.getParams()获取传递的参数,此外,在类web范式中,参数也可以在页面中直接使用,如this.keyValue(keyValue为跳转时params参数中的key值),如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 | +| 名称 | 参数类型 | 必填 | 说明 | +| ------ | -------- | ---- | ------------------------------------------------------------ | +| uri | string | 是 | 目标页面的uri,可以是以下的两种格式:
1. 页面的绝对路径,由config.json文件中的页面列表提供。例如:
- pages/index/index
-pages/detail/detail
2. 特定路径。如果URI为斜杠(/),则显示主页。 | +| params | object | 否 | 表示路由跳转时要同时传递到目标页面的数据。跳转到目标页面后,使用router.getParams()获取传递的参数,此外,在类web范式中,参数也可以在页面中直接使用,如this.keyValue(keyValue为跳转时params参数中的key值),如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 | ## BackRouterOptions @@ -351,10 +351,10 @@ export default { **系统能力:** 以下各项对应的系统能力有所不同,详见下表。 -| 名称 | 参数类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------------------------------- | -| uri | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full | -| params | Object | 否 | 跳转时要同时传递到目标页面的数据。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite | +| 名称 | 参数类型 | 必填 | 说明 | +| ------ | -------- | ---- | ------------------------------------------------------------ | +| uri | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full | +| params | object | 否 | 跳转时要同时传递到目标页面的数据。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite | ## RouterState @@ -395,6 +395,6 @@ export default { ## ParamsInterface -| 名称 | 参数类型 | 说明 | -| ------------- | ------ | ------- | -| [key: string] | Object | 路由参数列表。 | +| 名称 | 参数类型 | 说明 | +| ------------- | -------- | -------------- | +| [key: string] | object | 路由参数列表。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-storage.md b/zh-cn/application-dev/reference/apis/js-apis-system-storage.md index cbe6e36b0213db138c535767ed85b1902a4d9511..d35b15d1ff5afe4fef74655c11b1b44da7e39621 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-storage.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-storage.md @@ -2,22 +2,21 @@ > **说明:** > -> - 从API Version 6开始,该模块不再维护,可以使用模块[`@ohos.data.storage`](js-apis-data-storage.md)。在API Version 9后,推荐使用新模块[`@ohos.data.preferences`](js-apis-data-preferences.md)。 +> - 从API Version 6开始,该模块不再维护,可以使用模块[`@ohos.data.storage`](js-apis-data-storage.md)。在API Version 9后,推荐使用新模块[`@ohos.data.preferences`](js-apis-data-preferences.md)。 > -> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> - 本模块接口仅可在FA模型下使用。 +> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> - 本模块接口仅可在FA模型下使用。 ## 导入模块 - ```js import storage from '@system.storage'; ``` - ## storage.get -get(Object): void +get(options: GetStorageOptions): void 通过索引读取缓存中存储的值。 @@ -25,13 +24,9 @@ get(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| key | string | 是 | 内容索引。 | -| default | string | 否 | key不存在则返回的默认值。 | -| success | Function | 否 | 接口调用成功的回调函数,data为返回key对应的value。 | -| fail | Function | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | -------------------- | ---- | ---------- | +| options | [GetStorageOptions](#getstorageoptions) | 是 | 接口配置信息。 | **示例:** @@ -54,10 +49,9 @@ export default { } ``` - ## storage.set -set(Object): void +get(options: SetStorageOptions): void 修改缓存中索引对应的值。 @@ -65,13 +59,9 @@ set(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| key | string | 是 | 要修改的存储值的索引。 | -| value | string | 是 | 新值。长度需小于128字节。 | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------- | ---- | ---------- | +| options | [SetStorageOptions](#setstorageoptions) | 是 | 接口配置信息。 | **示例:** @@ -92,10 +82,9 @@ export default { } ``` - ## storage.clear -clear(Object): void +clear(options?: ClearStorageOptions): void 清空缓存中存储的键值对。 @@ -103,11 +92,9 @@ clear(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------- | ---- | -------------- | +| options | [ClearStorageOptions](#clearstorageoptions) | 否 | 接口配置信息。 | **示例:** @@ -126,10 +113,9 @@ export default { } ``` - ## storage.delete -delete(Object): void +delete(options: DeleteStorageOptions): void 删除缓存中索引对应的键值对。 @@ -137,12 +123,9 @@ delete(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| key | string | 是 | 内容索引。 | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------------- | ---- | -------------- | +| options | [DeleteStorageOptions](#deletestorageoptions) | 是 | 接口配置信息。 | **示例:** @@ -160,4 +143,52 @@ export default { }); } } -``` \ No newline at end of file +``` + +## GetStorageOptions + +**系统能力:** SystemCapability.DistributedDataManager.Preferences.Core + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ---------------- | ---- | ------------------- | +| key | string | 是 | 内容索引。 | +| default | string | 否 | key不存在则返回的默认值。 | +| success | (data: any) => void | 否 | 接口调用成功的回调函数,data为返回key对应的value。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | + + +## SetStorageOptions + +**系统能力:** SystemCapability.DistributedDataManager.Preferences.Core + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------- | ---- | -------------------- | +| key | string | 是 | 要修改的存储值的索引。 | +| value | string | 是 | 新值。长度需小于128字节。 | +| success | () => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | + + +## ClearStorageOptions + +**系统能力:** SystemCapability.DistributedDataManager.Preferences.Core + +| 名称 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | -------------------- | +| success | () => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | + + +## DeleteStorageOptions + +**系统能力:** SystemCapability.DistributedDataManager.Preferences.Core + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ------------------ | +| key | string | 是 | 内容索引。 | +| success | () => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数,data为错误信息,code为错误码。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-url.md b/zh-cn/application-dev/reference/apis/js-apis-url.md index b495cda9f39ed5c76d72da5d403460eea3874d47..3b2bde779638b1eb23e3a7138f1505054a0cd0fd 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-url.md +++ b/zh-cn/application-dev/reference/apis/js-apis-url.md @@ -31,7 +31,7 @@ URLParams的构造函数。 let objectParams = new Url.URLParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); let objectParams1 = new Url.URLParams({"fod" : '1' , "bard" : '2'}); let objectParams2 = new Url.URLParams('?fod=1&bard=2'); -let urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); +let urlObject = Url.URL.parseURL('https://developer.mozilla.org/?fod=1&bard=2'); let params = new Url.URLParams(urlObject.search); ``` @@ -54,7 +54,7 @@ append(name: string, value: string): void **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let urlObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLParams(urlObject.search.slice(1)); paramsObject.append('fod', '3'); ``` @@ -77,7 +77,7 @@ delete(name: string): void **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let urlObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsobject = new Url.URLParams(urlObject.search.slice(1)); paramsobject.delete('fod'); ``` @@ -106,7 +106,7 @@ getAll(name: string): string[] **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let urlObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let params = new Url.URLParams(urlObject.search.slice(1)); params.append('fod', '3'); // Add a second value for the fod parameter. console.log(params.getAll('fod').toString()) // Output ["1","3"]. @@ -131,7 +131,7 @@ entries(): IterableIterator<[string, string]> ```js let searchParamsObject = new Url.URLParams("keyName1=valueName1&keyName2=valueName2"); -for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs +for (var pair of searchParamsObject.entries()) { // Show keyName/valueName pairs console.log(pair[0]+ ', '+ pair[1]); } ``` @@ -163,9 +163,9 @@ forEach(callbackFn: (value: string, key: string, searchParams: this) => void, th **示例:** ```js -const myURLObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); -myURLObject.searchParams.forEach((value, name, searchParams) => { - console.log(name, value, myURLObject.searchParams === searchParams); +const myURLObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); +myURLObject.params.forEach((value, name, searchParams) => { + console.log(name, value, myURLObject.params === searchParams); }); ``` @@ -223,7 +223,7 @@ has(name: string): boolean **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let urlObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLParams(urlObject.search.slice(1)); paramsObject.has('bard') === true; ``` @@ -247,7 +247,7 @@ set(name: string, value: string): void **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let urlObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLParams(urlObject.search.slice(1)); paramsObject.set('baz', '3'); // Add a third parameter. ``` @@ -359,7 +359,7 @@ toString(): string **示例:** ```js -let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let url = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let params = new Url.URLParams(url.search.slice(1)); params.append('fod', '3'); console.log(params.toString()); @@ -423,8 +423,16 @@ new Url.URL('https://www.example.com', ); // Output https://www.example.com/ new Url.URL('https://www.example.com', b); // Output https://www.example.com/ ``` -### parseURL9+ +### constructor9+ + +constructor() +URL的无参构造函数。parseURL调用后返回一个URL对象,不单独使用。 + +**系统能力:** SystemCapability.Utils.Lang + +### parseURL9+ + static parseURL(url : string, base?: string | URL): URL URL静态成员函数。 @@ -442,7 +450,8 @@ URL静态成员函数。 ```js let mm = 'https://username:password@host:8080'; -Url.URL.parseURL(mm); // Output 'https://username:password@host:8080/'; +let url = Url.URL.parseURL(mm); +url.toString(); // Output 'https://username:password@host:8080/'; ``` ### tostring @@ -462,7 +471,7 @@ toString(): string **示例:** ```js -const url = new Url.URL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +const url = Url.URL.parseURL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); url.toString(); ``` @@ -482,7 +491,7 @@ toJSON(): string **示例:** ```js -const url = new Url.URL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +const url = Url.URL.parseURL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); url.toJSON(); ``` @@ -624,7 +633,7 @@ entries(): IterableIterator<[string, string]> ```js let searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2"); -for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs +for (var pair of searchParamsObject.entries()) { // Show keyName/valueName pairs console.log(pair[0]+ ', '+ pair[1]); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-webview.md b/zh-cn/application-dev/reference/apis/js-apis-webview.md index 595fafbbc48f861eb33aca0252cfc050739e7371..bfc5d5c9fda0df3a501f9c051400e3c95a3ca00c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-webview.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webview.md @@ -18,6 +18,46 @@ ```ts import web_webview from '@ohos.web.webview'; ``` + +### once + +once(type: string, callback: Callback\): void + +订阅一次指定类型Web事件的回调。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------- | ---- | -------------------- | +| type | string | 是 | Web事件的类型,目前支持:"webInited"(Web初始化完成)。 | +| headers | Callback\ | 是 | 所订阅的回调函数。 | + +**示例:** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +web_webview.once("webInited", () => { + console.log("setCookie") + web_webview.WebCookieManager.setCookie("www.example.com", "a=b") +}) + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + ## WebMessagePort 通过WebMessagePort可以进行消息的发送以及接收。 @@ -2694,6 +2734,55 @@ struct WebComponent { } ``` +### customizeSchemes + +static customizeSchemes(schemes: Array\): void + +配置Web自定义协议请求的权限。建议在任何Web组件初始化之前进行调用。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------- | ---- | -------------------------------------- | +| schemes | Array\<[WebCustomScheme](#webcustomscheme)\> | 是 | 自定义协议配置,最多支持同时配置10个自定义协议。 | + +**示例:** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + responseweb: WebResourceResponse = new WebResourceResponse() + scheme1: web_webview.WebCustomScheme = {schemeName: "name1", isSupportCORS: true, isSupportFetch: true} + scheme2: web_webview.WebCustomScheme = {schemeName: "name2", isSupportCORS: true, isSupportFetch: true} + scheme3: web_webview.WebCustomScheme = {schemeName: "name3", isSupportCORS: true, isSupportFetch: true} + + aboutToAppear():void { + try { + web_webview.WebviewController.customizeSchemes([this.scheme1, this.scheme2, this.scheme3]) + } catch(error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + } + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onInterceptRequest((event) => { + console.log('url:' + event.request.getRequestUrl()) + return this.responseweb + }) + } + } +} +``` + ## WebCookieManager 通过WebCookie可以控制Web组件中的cookie的各种行为,其中每个应用中的所有web组件共享一个WebCookieManager实例。 @@ -4399,4 +4488,15 @@ struct WebComponent { | historyRawUrl | string | 是 | 否 | 历史记录项的原始url地址。 | | title | string | 是 | 否 | 历史记录项的标题。 | -### \ No newline at end of file + +## WebCustomScheme + +自定义协议配置。 + +**系统能力:** SystemCapability.Web.Webview.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | --------- | ---- | ---- | ---------------------------- | +| schemeName | string | 是 | 是 | 自定义协议名称。最大长度为32,其字符仅支持小写字母、数字、'.'、'+'、'-'。 | +| isSupportCORS | boolean | 是 | 是 | 是否支持跨域请求。 | +| isSupportFetch | boolean | 是 | 是 | 是否支持fetch请求。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md index bfebb81d8ccb8ae8f3a6bf538e9153cfc95076f1..17032035c09dfd69578339fe65354bf3c030ea54 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -27,7 +27,7 @@ Image(src: string | PixelMap | Resource) | 参数名 | 参数类型 | 必填 | 参数描述 | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource类型) | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`Image("common/test.jpg")`,不支持跨包/跨模块调用该Image组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持`datashare://`路径前缀的字符串,用于访问通过data ability提供的图片路径。
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。 | +| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource类型) | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`Image("common/test.jpg")`,不支持跨包/跨模块调用该Image组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持`datashare://`路径前缀的字符串,用于访问通过data ability提供的图片路径。图片加载前需要申请[媒体库功能相关权限](../../file-management/medialibrary-overview.md#申请媒体库功能相关权限)
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。 | ## 属性 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index 8ad8242fa2556b9b6f495bc7b46abc13f9e49bc2..460207b2fd071cdb84fa49ee3afb99a5a3c830e9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -1115,6 +1115,70 @@ webCursiveFont(family: string) } ``` +### darkMode9+ + +darkMode(mode: WebDarkMode) + +设置Web深色模式,默认关闭。当深色模式开启时,Web将启用媒体查询prefer-color-scheme中网页所定义的深色样式,若网页未定义深色样式,则保持原状。如需开启强制深色模式,建议配合[forceDarkAccess](#forcedarkaccess9)使用。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | +| ------ | ----------- | ---- | --------------- | ------------------ | +| mode | [WebDarkMode](#webdarkmode9枚举说明) | 是 | WebDarkMode.Off | 设置Web的深色模式为关闭、开启或跟随系统。 | + +**示例:** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + @State mode: WebDarkMode = WebDarkMode.On + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .darkMode(this.mode) + } + } + } + ``` + +### forceDarkAccess9+ + +forceDarkAccess(access: boolean) + +设置网页是否开启强制深色模式。默认关闭。该属性仅在[darkMode](#darkmode9)开启深色模式时生效。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | +| ------ | ------- | ---- | ----- | ------------------ | +| access | boolean | 是 | false | 设置网页是否开启强制深色模式。 | + +**示例:** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + @State mode: WebDarkMode = WebDarkMode.On + @State access: boolean = true + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .darkMode(this.mode) + .forceDarkAccess(this.access) + } + } + } + ``` + ## 事件 不支持通用事件。 @@ -6102,6 +6166,13 @@ onSslErrorEventReceive接口返回的SSL错误的具体原因。 | --------- | ------------- | -------------------------- | | MidiSysex | MIDI SYSEX资源。 | 目前仅支持权限事件上报,MIDI设备的使用还未支持。 | +## WebDarkMode9+枚举说明 +| 名称 | 描述 | +| ------- | ------------------------------------ | +| Off | Web深色模式关闭。 | +| On | Web深色模式开启。 | +| Auto | Web深色模式跟随系统。 | + ## WebAsyncController 通过WebAsyncController可以控制Web组件具有异步回调通知的行为,一个WebAsyncController对象控制一个Web组件。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md index b4ba444f881be19c4be8bc5f5a422e3c0f3ec2d2..169d33852c2628c3b25aad7cdc6f8999f6f99361 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md @@ -134,7 +134,7 @@ struct AlphabetIndexerSample { .selectedFont({ size: 16, weight: FontWeight.Bolder }) // 选中项字体样式 .popupFont({ size: 30, weight: FontWeight.Bolder }) // 弹出框内容的字体样式 .itemSize(28) // 每一项的尺寸大小 - .alignStyle(IndexerAlign.Left) // 弹出框在索引条左侧弹出 + .alignStyle(IndexerAlign.Left) // 弹出框在索引条右侧弹出 .onSelect((index: number) => { console.info(this.value[index] + ' Selected!') }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md index 17328cec7f6387f6526810d6ffb50fe33ee49553..e6511abfc7f4e969909655b05594e93df9764542 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -20,7 +20,7 @@ animateTo(value: AnimateParam, event: () => void): void | -------- | -------- | -------- | | duration | number | 动画持续时间,单位为毫秒。
默认值:1000 | | tempo | number | 动画的播放速度,值越大动画播放越快,值越小播放越慢,为0时无动画效果。
默认值:1.0 | -| curve | Curve \| Curves | 动画曲线。
默认值:Curve.Linear | +| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.Linear | | delay | number | 单位为ms(毫秒),默认不延时播放。
默认值:0 | | iterations | number | 默认播放一次,设置为-1时表示无限次播放。
默认值:1 | | playMode | [PlayMode](ts-appendix-enums.md#playmode) | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal | diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md b/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md index ad8fb47ea9149b0bf14fd1907c681f4b1a76a613..c387747a3624faee64a3540945112c879c8a073f 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md @@ -70,7 +70,7 @@ Not found. **可能原因** -在调用删除数据库、数据查询、数据删除等接口时未找到相关数据,可能原因如下。 +在调用删除数据库、数据查询、数据同步等接口时未找到相关数据,可能原因如下。 1. 删除数据库操作时,数据库不存在或已删除。 2. 数据库数据查询操作时,相关数据不存在或已删除。 3. 数据库数据同步操作时,数据库不存在或已删除。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-router.md b/zh-cn/application-dev/reference/errorcodes/errorcode-router.md index 45d158081c4275c0c9cc43822df901b44ae20899..6c0c856d7b7e6a62fb25f215a5e0d34a0e5d0ca0 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-router.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-router.md @@ -18,7 +18,7 @@ Internal error. NA -## 100002 路由输入的uri错误 +## 100002 路由页面跳转时输入的uri错误 错误信息 @@ -54,7 +54,7 @@ Page stack error. The pages are pushed too much. 请清除多余或无效的页面。 -## 200002 路由输入的uri错误 +## 200002 路由页面替换时输入的uri错误 **错误信息** diff --git a/zh-cn/application-dev/security/permission-verify-guidelines.md b/zh-cn/application-dev/security/permission-verify-guidelines.md index 5f738e40c602a18331b4abcb0d529e756a9d32e4..57c3beb7c2ae30b00ad92c0304e0acd6ae4026dd 100644 --- a/zh-cn/application-dev/security/permission-verify-guidelines.md +++ b/zh-cn/application-dev/security/permission-verify-guidelines.md @@ -18,6 +18,8 @@ 进行权限校验的开发步骤为: 1. 获取调用者的身份标识:tokenId。 + > **说明:**
+ > 获取访问者身份标识tokenId的方法 getCallingTokenId 可参考[API参考](../reference/apis/js-apis-rpc.md)。 2. 待校验的权限名:ohos.permission.PERMISSION。 3. 使用verifyAccessToken接口对当前调用者进行权限校验。 4. 根据权限校验结果采取对应的措施。 @@ -41,6 +43,4 @@ } } -``` -> **说明:** -> 获取访问者身份标识tokenId的方法 getCallingTokenId 可参考[API参考](../reference/apis/js-apis-rpc.md)。 \ No newline at end of file +``` \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md b/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md index c8163cb4497b444bc0ab5ee0f99f7adbc6177474..97ced497533ad81bd4bbe4c84de37ce175eb7604 100644 --- a/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md +++ b/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md @@ -407,6 +407,8 @@ } ``` + ![zh-cn_image_0000001215199399](figures/zh-cn_image_0000001215199399.png) + 5. 使用自定义构造函数\@Builder简化代码。可以发现,每个成分表中的成分单元其实都是一样的UI结构。 ![zh-cn_image_0000001169599582](figures/zh-cn_image_0000001169599582.png) diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-multimedia.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..45249cf9851984f3119e534f732d694eacf1e31f --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-multimedia.md @@ -0,0 +1,53 @@ +## cl.multimedia.av_session.001 av_session所有接口更换为系统接口 + +所有av_session的接口变更为SystemApi。 + +**变更影响** + +非系统应用无法调用系统接口,如调用方为非系统应用或未申请SystemApi相关权限,将无法调用接口。 + +**关键的接口/组件变更** + +所有接口均变更为SystemApi,接口明细如下: + +| 接口、枚举或变量名 | 类型 | 是否为SystemApi | +| -------- | -------- | ------- | +| SessionToken | interface | 是 | +| AVMetadata | interface | 是 | +| AVPlaybackState | interface | 是 | +| PlaybackPosition | interface | 是 | +| OutputDeviceInfo | interface | 是 | +| AVSessionDescriptor | interface | 是 | +| AVSessionController | interface | 是 | +| AVControlCommand | interface | 是 | +| createAVSession | function | 是 | +| getAllSessionDescriptors | function | 是 | +| createController | function | 是 | +| castAudio | function | 是 | +| on | function | 是 | +| off | function | 是 | +| sendSystemAVKeyEvent | function | 是 | +| sendSystemControlCommand | function | 是 | +| sessionId | variable | 是 | +| setAVMetadata | function | 是 | +| setAVPlaybackState | function | 是 | +| setLaunchAbility | function | 是 | +| getController | function | 是 | +| getOutputDevice | function | 是 | +| activate | function | 是 | +| deactivate | function | 是 | +| destroy | function | 是 | +| getAVPlaybackState | function | 是 | +| getAVMetadata | function | 是 | +| getOutputDevice | function | 是 | +| sendAVKeyEvent | function | 是 | +| getLaunchAbility | function | 是 | +| getRealPlaybackPositionSync | function | 是 | +| isActive | function | 是 | +| getValidCommands | function | 是 | +| sendControlCommand | function | 是 | +| AVSessionType | type | 是 | +| AVControlCommandType | type | 是 | +| LoopMode | enum | 是 | +| PlaybackState | enum | 是 | +| AVSessionErrorCode | enum | 是 |