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 959f924a34bbe7fd48ded0a20c3b38178b323035..a140452948660edabecc87e7b98706b91c51a268 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 @@ -1,6 +1,6 @@ # 页面级变量的状态管理 -@State、@Prop、@Link、@Provide、Consume、@ObjectLink、@Observed和@Watch用于管理页面级变量的状态。 +@State、@Prop、@Link、@Provide、@Consume、@ObjectLink、@Observed和@Watch用于管理页面级变量的状态。 请参考[状态变量多种数据类型声明的使用限制](./arkts-restrictions-and-extensions.md)了解@State、@Provide、 @Link和@Consume四种状态变量的约束条件。 diff --git a/zh-cn/application-dev/quick-start/start-with-ets-fa.md b/zh-cn/application-dev/quick-start/start-with-ets-fa.md index d46eed64a67cb2d772aea6f9ab2a5c830bf0d4a2..8508a182044fa156f6253aa4f08168c32ec694ef 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets-fa.md +++ b/zh-cn/application-dev/quick-start/start-with-ets-fa.md @@ -190,6 +190,7 @@ ```ts // index.ets + // 导入页面路由模块 import router from '@ohos.router'; @Entry @@ -234,6 +235,7 @@ ```ts // second.ets + // 导入页面路由模块 import router from '@ohos.router'; @Entry diff --git a/zh-cn/application-dev/quick-start/start-with-ets-stage.md b/zh-cn/application-dev/quick-start/start-with-ets-stage.md index c375f39617a906a52afd43589b9c7cd429105446..2db4732dc202fe9f23bb8b07008869607809a8ec 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets-stage.md +++ b/zh-cn/application-dev/quick-start/start-with-ets-stage.md @@ -189,6 +189,7 @@ ```ts // index.ets + // 导入页面路由模块 import router from '@ohos.router'; @Entry @@ -233,6 +234,7 @@ ```ts // second.ets + // 导入页面路由模块 import router from '@ohos.router'; @Entry diff --git a/zh-cn/application-dev/quick-start/start-with-js-fa.md b/zh-cn/application-dev/quick-start/start-with-js-fa.md index 6e565e5f603ae0c9f5f78e75b2cad30103dece3b..5ff342becee7da2850a374270c9d2f0e875615f1 100644 --- a/zh-cn/application-dev/quick-start/start-with-js-fa.md +++ b/zh-cn/application-dev/quick-start/start-with-js-fa.md @@ -183,6 +183,7 @@ ```js // index.js + // 导入页面路由模块 import router from '@ohos.router'; export default { @@ -200,6 +201,7 @@ ```js // second.js + // 导入页面路由模块 import router from '@ohos.router'; export default { diff --git a/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md b/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md index 80e40eb4bb410bf40425842e56f0e7a0bf9a8582..d8e5e1b251feb62851336d77d58c040d39b77b9c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @@ -60,7 +60,7 @@ buffer数组的列表。 ## EncodingBlob -证书链数据,在证书链校验时,作为入参传入。 +带编码格式的证书二进制数组。 ### 属性 @@ -1029,7 +1029,7 @@ console.info("key hex:" + uint8ArrayToShowStr(encodedKey.data)); // 输出全 getEncoded() : DataBlob -以同步方法,获取二进制形式的密钥内容。 +以同步方法,获取二进制形式的密钥内容。公钥格式满足ASN.1语法、X.509规范、DER编码格式。 **系统能力:** SystemCapability.Security.CryptoFramework @@ -1065,7 +1065,7 @@ console.info("key encoded:" + Uint8ArrayToShowStr(encodedKey.data)); getEncoded() : DataBlob -以同步方法,获取二进制形式的密钥内容。 +以同步方法,获取二进制形式的密钥内容。私钥格式满足ASN.1语法,PKCS#8规范、DER编码方式。 **系统能力:** SystemCapability.Security.CryptoFramework @@ -1437,11 +1437,9 @@ keyGenPromise.then( keyPair => { **密钥转换说明** -1. RSA二进制密钥数据,按keysize(32位) ,nsize(keysize/8), esize(e实际长度),dsize(keysize/8),nval(大数n的二进制数据),eval(大数e的二进制数据),dval(大数d的二进制数据)拼接形成。 -2. RSA二进制密钥数据中,nsize和dsize为密钥位数/8,esize为具体的实际长度。 -3. RSA私钥数据需要包含keysize,nsize,esize,dsize,nval,eval,dval的全部数据,公钥材料中dsize设置为0,缺省dval的数据。 -4. RSA二进制密钥数据中,keysize、nsize、esize和dsize为32位二进制数据,数据的大小端格式请按设备CPU默认格式,密钥材料(nval、eval、dval)统一为大端格式。 -5. convertKey接口中,公钥和私钥二进制数据为可选项,可单独传入公钥或私钥的数据,生成对应只包含公钥或私钥的KeyPair对象。 +1. 非对称密钥(RSA、ECC)的公钥和私钥调用getEncoded()方法后,分别返回X.509格式和PKCS#8格式的二进制数据,此数据可用于跨应用传输或持久化存储。 +2. 当调用convertKey方法将外来二进制数据转换为算法库非对称密钥对象时,公钥应满足ASN.1语法、X.509规范、DER编码格式,私钥应满足ASN.1语法、PKCS#8规范、DER编码格式。 +3. convertKey方法中,公钥和密钥二进制数据非必选项,可单独传入公钥或私钥的数据,生成对应只包含公钥或私钥的KeyPair对象。 ## cryptoFramework.createCipher diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileio.md b/zh-cn/application-dev/reference/apis/js-apis-fileio.md index 25d4499022f4a77670b49ac4f79ddae7d27316b1..9ba948beaccf86693e6d13fe257ab5554212659b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileio.md @@ -68,7 +68,7 @@ stat(path: string): Promise<Stat> ```js let filePath = pathDir + "test.txt"; fileio.stat(filePath).then(function(stat){ - console.info("getFileInfo succeed:"+ JSON.stringify(stat)); + console.info("getFileInfo succeed, the size of file is " + stat.size); }).catch(function(err){ console.info("getFileInfo failed with error:"+ err); }); @@ -153,7 +153,7 @@ opendir(path: string): Promise<Dir> ```js let dirPath = pathDir + "/testDir"; fileio.opendir(dirPath).then(function(dir){ - console.info("opendir succeed:"+ JSON.stringify(dir)); + console.info("opendir succeed"); }).catch(function(err){ console.info("opendir failed with error:"+ err); }); @@ -1178,7 +1178,7 @@ fstat(fd: number): Promise<Stat> let filePath = pathDir + "/test.txt"; let fd = fileio.openSync(filePath); fileio.fstat(fd).then(function(stat){ - console.info("fstat succeed:"+ JSON.stringify(stat)); + console.info("fstat succeed, the size of file is "+ stat.size); }).catch(function(err){ console.info("fstat failed with error:"+ err); }); @@ -1525,7 +1525,7 @@ lstat(path: string): Promise<Stat> ```js let filePath = pathDir + "/test.txt"; fileio.lstat(filePath).then(function(stat){ - console.info("get link status succeed:"+ JSON.stringify(stat)); + console.info("get link status succeed, " + the size of file is + stat.size); }).catch(function(err){ console.info("get link status failed with error:"+ err); }); @@ -3166,7 +3166,7 @@ read(): Promise<Dirent> ```js dir.read().then(function (dirent){ - console.log("read succeed:"+JSON.stringify(dirent)); + console.log("read succeed, the name of dirent is " + dirent.name); }).catch(function(err){ console.info("read failed with error:"+ err); }); @@ -3193,7 +3193,7 @@ read(callback: AsyncCallback<Dirent>): void dir.read(function (err, dirent) { if (dirent) { // do something - console.log("read succeed:"+JSON.stringify(dirent)); + console.log("read succeed, the name of file is " + dirent.name); } }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md index b255b0a2f4a3fc86fb06170ae182267c33d3c339..5ddc299f650e5fed2f429f7cbd1458c3d9f552f3 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md @@ -1,7 +1,7 @@ # 输入设备 -输入设备管理模块,用于监听输入设备连接、断开和变化,并查看输入设备相关信息。比如监听鼠标插拔,并获取鼠标的id、name和指针移动速度等信息。 +输入设备管理模块,用于监听输入设备连接和断开状态,查询输入设备相关信息。 > **说明**: @@ -20,15 +20,15 @@ import inputDevice from '@ohos.multimodalInput.inputDevice'; getDeviceList(callback: AsyncCallback<Array<number>>): void -获取所有输入设备的id列表,使用callback方式作为异步方法。 +获取所有输入设备的id列表,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **参数**: -| 参数 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | ---------- | -| callback | AsyncCallback<Array<number>> | 是 | 回调函数。 | +| 参数 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| callback | AsyncCallback<Array<number>> | 是 | 回调函数,异步返回所有输入设备的id列表。 | **示例**: @@ -36,15 +36,13 @@ getDeviceList(callback: AsyncCallback<Array<number>>): void try { inputDevice.getDeviceList((error, ids) => { if (error) { - console.log(`Failed to get device list. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } - this.data = ids; - console.log("The device ID list is: " + ids); + console.log(`Device id list: ${JSON.stringify(ids)}`); }); } catch (error) { - console.info("getDeviceList " + error.code + " " + error.message); + console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -52,25 +50,25 @@ try { getDeviceList(): Promise<Array<number>> -获取所有输入设备的id列表,使用Promise方式作为异步方法。 +获取所有输入设备的id列表,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **返回值**: -| 参数 | 说明 | -| ---------------------------------- | ------------------------------- | -| Promise<Array<number>> | Promise实例,用于异步获取结果。 | +| 参数 | 说明 | +| ---------------------------------- | ------------------------------------------- | +| Promise<Array<number>> | Promise对象,异步返回所有输入设备的id列表。 | **示例**: ```js try { inputDevice.getDeviceList().then((ids) => { - console.log("The device ID list is: " + ids); + console.log(`Device id list: ${JSON.stringify(ids)}`); }); } catch (error) { - console.info("getDeviceList " + error.code + " " + error.message); + console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -78,7 +76,7 @@ try { getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void -获取输入设备的描述信息,使用callback方式作为异步方法。 +获取指定输入设备的信息,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice @@ -86,24 +84,23 @@ getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): | 参数 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------------------- | ---- | --------------------------------------- | -| deviceId | number | 是 | 需要获取信息的设备id。 | -| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | 是 | 回调函数,异步返回InputDeviceData对象。 | +| deviceId | number | 是 | 输入设备id。 | +| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | 是 | 回调函数,异步返回输入设备信息。 | **示例**: ```js -// 示例获取设备id为1的设备name信息。 +// 获取输入设备id为1的设备信息。 try { - inputDevice.getDeviceInfo(1, (error, inputDevice) => { + inputDevice.getDeviceInfo(1, (error, deviceData) => { if (error) { - console.log(`Failed to get device information. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } - console.log("The device name is: " + inputDevice.name); + console.log(`Device info: ${JSON.stringify(deviceData)}`); }); } catch (error) { - console.info("getDeviceInfo " + error.code + " " + error.message); + console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -111,7 +108,7 @@ try { getDeviceInfo(deviceId: number): Promise<InputDeviceData> -获取输入设备的描述信息,使用Promise方式作为异步方法。 +获取指定输入设备的信息,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice @@ -119,30 +116,30 @@ getDeviceInfo(deviceId: number): Promise<InputDeviceData> | 参数 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ---------------------- | -| deviceId | number | 是 | 需要获取信息的设备id。 | +| deviceId | number | 是 | 输入设备id。 | **返回值**: | 参数 | 说明 | | -------------------------------------------------- | ------------------------------- | -| Promise<[InputDeviceData](#inputdevicedata)> | Promise实例,用于异步获取结果。 | +| Promise<[InputDeviceData](#inputdevicedata)> | Promise对象,异步返回输入设备信息。 | **示例**: ```js -// 示例获取设备id为1的设备name信息。 +// 获取输入设备id为1的设备信息。 try { - inputDevice.getDeviceInfo(id).then((inputDevice) => { - console.log("The device name is: " + inputDevice.name); + inputDevice.getDeviceInfo(1).then((deviceData) => { + console.log(`Device info: ${JSON.stringify(deviceData)}`); }); } catch (error) { - console.info("getDeviceInfo " + error.code + " " + error.message); + console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## inputDevice.on9+ -on(type: “change”, listener: Callback<DeviceListener>): void +on(type: "change", listener: Callback<DeviceListener>): void 监听输入设备的热插拔事件。 @@ -153,7 +150,7 @@ on(type: “change”, listener: Callback<DeviceListener>): void | 参数 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ----------- | | type | string | 是 | 输入设备的事件类型。 | -| listener | Callback<[DeviceListener](#devicelistener9)> | 是 | 可上报的输入设备事件。 | +| listener | Callback<[DeviceListener](#devicelistener9)> | 是 | 回调函数,异步上报输入设备热插拔事件。 | **示例**: @@ -161,13 +158,13 @@ on(type: “change”, listener: Callback<DeviceListener>): void let isPhysicalKeyboardExist = true; try { inputDevice.on("change", (data) => { - console.log("type: " + data.type + ", deviceId: " + data.deviceId); - inputDevice.getKeyboardType(data.deviceId, (err, ret) => { - console.log("The keyboard type of the device is: " + ret); - if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') { + console.log(`Device event info: ${JSON.stringify(data)}`); + inputDevice.getKeyboardType(data.deviceId, (err, type) => { + console.log("The keyboard type is: " + type); + if (type == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') { // 监听物理键盘已连接。 isPhysicalKeyboardExist = true; - } else if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') { + } else if (type == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') { // 监听物理键盘已断开。 isPhysicalKeyboardExist = false; } @@ -175,13 +172,13 @@ try { }); // 根据isPhysicalKeyboardExist的值决定软键盘是否弹出。 } catch (error) { - console.info("oninputdevcie " + error.code + " " + error.message); + console.log(`Get device info failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## inputDevice.off9+ -off(type: “change”, listener?: Callback<DeviceListener>): void +off(type: "change", listener?: Callback<DeviceListener>): void 取消监听输入设备的热插拔事件。 @@ -192,42 +189,41 @@ off(type: “change”, listener?: Callback<DeviceListener>): void | 参数 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ----------- | | type | string | 是 | 输入设备的事件类型。 | -| listener | Callback<[DeviceListener](#devicelistener9)> | 否 | 可上报的输入设备事件。 | +| listener | Callback<[DeviceListener](#devicelistener9)> | 否 | 取消监听的回调函数。 | **示例**: ```js callback: function(data) { - console.log("type: " + data.type + ", deviceId: " + data.deviceId); + console.log(`Report device event info: ${JSON.stringify(data, [`type`, `deviceId`])}`); } try { inputDevice.on("change", this.callback); } catch (error) { - console.info("oninputdevcie " + error.code + " " + error.message) + console.log(`Listen device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } -// 单独取消listener的监听。 +// 取消指定的监听。 try { inputDevice.off("change", this.callback); } catch (error) { - console.info("offinputdevcie " + error.code + " " + error.message) + console.log(`Cancel listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } // 取消所有监听。 try { inputDevice.off("change"); } catch (error) { - console.info("offinputdevcie " + error.code + " " + error.message); + console.log(`Cancel all listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } -// 取消监听后,软键盘默认都弹出。 ``` ## inputDevice.getDeviceIds(deprecated) getDeviceIds(callback: AsyncCallback<Array<number>>): void -获取所有输入设备的id列表,使用callback方式作为异步方法。 +获取所有输入设备的id列表,使用AsyncCallback异步方式返回结果。 从API version 9 开始不再维护,建议使用[inputDevice.getDeviceList](#inputdevicegetdevicelist9)代替。 @@ -235,15 +231,19 @@ getDeviceIds(callback: AsyncCallback<Array<number>>): void **参数**: -| 参数 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | ----- | -| callback | AsyncCallback<Array<number>> | 是 | 回调函数。 | +| 参数 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| callback | AsyncCallback<Array<number>> | 是 | 回调函数,异步返回所有输入设备的id列表。 | **示例**: ```js -inputDevice.getDeviceIds((ids)=>{ - console.log("The device ID list is: " + ids); +inputDevice.getDeviceList((error, ids) => { + if (error) { + console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Device id list: ${JSON.stringify(ids)}`); }); ``` @@ -251,7 +251,7 @@ inputDevice.getDeviceIds((ids)=>{ getDeviceIds(): Promise<Array<number>> -获取所有输入设备的id列表,使用Promise方式作为异步方法。 +获取所有输入设备的id列表,使用Promise异步方式返回结果。 从API version 9 开始不再维护,建议使用[inputDevice.getDeviceList](#inputdevicegetdevicelist9)代替。 @@ -259,15 +259,15 @@ getDeviceIds(): Promise<Array<number>> **返回值**: -| 参数 | 说明 | -| ---------------------------------- | ------------------- | -| Promise<Array<number>> | Promise实例,用于异步获取结果。 | +| 参数 | 说明 | +| ---------------------------------- | ------------------------------------------- | +| Promise<Array<number>> | Promise对象,异步返回所有输入设备的id列表。 | **示例**: ```js -inputDevice.getDeviceIds().then((ids)=>{ - console.log("The device ID list is: " + ids); +inputDevice.getDeviceList().then((ids) => { + console.log(`Device id list: ${JSON.stringify(ids)}`); }); ``` @@ -275,7 +275,7 @@ inputDevice.getDeviceIds().then((ids)=>{ getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void -获取输入设备的描述信息,使用callback方式作为异步方法。 +获取指定输入设备的信息,使用AsyncCallback异步方式返回结果。 从API version 9 开始不再维护,建议使用[inputDevice.getDeviceInfo](#inputdevicegetdeviceinfo9)代替。 @@ -283,17 +283,21 @@ getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): voi **参数**: -| 参数 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | --------------------------- | -| deviceId | number | 是 | 需要获取信息的设备id。 | -| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | 是 | 回调函数,异步返回InputDeviceData对象。 | +| 参数 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------------------- | ---- | -------------------------------- | +| deviceId | number | 是 | 输入设备id。 | +| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | 是 | 回调函数,异步返回输入设备信息。 | **示例**: ```js -// 示例获取设备id为1的设备name信息。 -inputDevice.getDevice(1, (inputDevice)=>{ - console.log("The device name is: " + inputDevice.name); +// 获取输入设备id为1的设备信息。 +inputDevice.getDeviceInfo(1, (error, deviceData) => { + if (error) { + console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Device info: ${JSON.stringify(deviceData)}`); }); ``` @@ -301,7 +305,7 @@ inputDevice.getDevice(1, (inputDevice)=>{ getDevice(deviceId: number): Promise<InputDeviceData> -获取输入设备的描述信息,使用Promise方式作为异步方法。 +获取指定输入设备的信息,使用Promise异步方式返回结果。 从API version 9 开始不再维护,建议使用[inputDevice.getDeviceInfo](#inputdevicegetdeviceinfo9)代替。 @@ -309,22 +313,22 @@ getDevice(deviceId: number): Promise<InputDeviceData> **参数**: -| 参数 | 类型 | 必填 | 说明 | +| 参数 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ------------ | -| deviceId | number | 是 | 需要获取信息的设备id。 | +| deviceId | number | 是 | 输入设备id。 | **返回值**: -| 参数 | 说明 | -| ---------------------------------------- | ------------------- | -| Promise<[InputDeviceData](#inputdevicedata)> | Promise实例,用于异步获取结果。 | +| 参数 | 说明 | +| -------------------------------------------------- | ----------------------------------- | +| Promise<[InputDeviceData](#inputdevicedata)> | Promise对象,异步返回输入设备信息。 | **示例**: ```js -// 示例获取设备id为1的设备name信息。 -inputDevice.getDevice(1).then((inputDevice)=>{ - console.log("The device name is: " + inputDevice.name); +// 获取输入设备id为1的设备信息。 +inputDevice.getDeviceInfo(1).then((deviceData) => { + console.log(`Device info: ${JSON.stringify(deviceData)}`); }); ``` @@ -332,28 +336,28 @@ inputDevice.getDevice(1).then((inputDevice)=>{ supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): void -获取输入设备支持的键码值,使用callback方式作为异步方法。 +获取输入设备是否支持指定的键码值,使用Callback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **参数**: -| 参数 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------ | ---- | --------------------------------- | -| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | -| keys | Array<KeyCode> | 是 | 需要查询的键码值,最多支持5个按键查询。 | -| callback | Callback<Array<boolean>> | 是 | 回调函数,异步返回查询结果。 | +| 参数 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------ | +| deviceId | number | 是 | 输入设备id,同一个物理设备反复插拔,设备id会发生变化。 | +| keys | Array<KeyCode> | 是 | 需要查询的键码值,最多支持5个按键查询。 | +| callback | Callback<Array<boolean>> | 是 | 回调函数,异步返回查询结果。 | **示例**: ```js -// 示例查询id为1的设备对于17、22和2055按键的支持情况。 +// 查询id为1的输入设备对于17、22和2055按键的支持情况。 try { - inputDevice.supportKeys(1, [17, 22, 2055], (error, ret) => { - console.log("The query result is as follows: " + ret); + inputDevice.supportKeys(1, [17, 22, 2055], (error, supportResult) => { + console.log(`Query result: ${JSON.stringify(supportResult)}`); }); } catch (error) { - console.info("supportKeys " + error.code + " " + error.message); + console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -361,33 +365,33 @@ try { supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>> -获取输入设备支持的键码值,使用Promise方式作为异步方法。 +获取输入设备是否支持指定的键码值,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **参数**: -| 参数 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | --------------------------------- | -| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | -| keys | Array<KeyCode> | 是 | 需要查询的键码值,最多支持5个按键查询。 | +| 参数 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ------------------------------------------------------ | +| deviceId | number | 是 | 输入设备id,同一个物理设备反复插拔,设备id会发生变化。 | +| keys | Array<KeyCode> | 是 | 需要查询的键码值,最多支持5个按键查询。 | **返回值**: -| 参数 | 说明 | -| ----------------------------------- | ------------------- | -| Promise<Array<boolean>> | Promise实例,用于异步获取结果。 | +| 参数 | 说明 | +| ----------------------------------- | ------------------------------- | +| Promise<Array<boolean>> | Promise对象,异步返回查询结果。 | **示例**: ```js -// 示例查询id为1的设备对于17、22和2055按键的支持情况。 +// 查询id为1的输入设备对于17、22和2055按键的支持情况。 try { - inputDevice.supportKeys(1, [17, 22, 2055]).then((ret) => { - console.log("The query result is as follows: " + ret); + inputDevice.supportKeys(1, [17, 22, 2055]).then((supportResult) => { + console.log(`Query result: ${JSON.stringify(supportResult)}`); }); } catch (error) { - console.info("supportKeys " + error.code + " " + error.message); + console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -395,32 +399,31 @@ try { getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void -查询输入设备的键盘类型,使用callback方式作为异步方法。 +获取输入设备的键盘类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **参数**: -| 参数 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | --------------------------------- | -| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | -| callback | AsyncCallback<[KeyboardType](#keyboardtype9)> | 是 | 回调函数,异步返回查询结果。 | +| 参数 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | +| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。 | +| callback | AsyncCallback<[KeyboardType](#keyboardtype9)> | 是 | 回调函数,异步返回查询结果。 | **示例**: ```js -// 示例查询设备id为1的设备键盘类型。 +// 查询id为1的输入设备的键盘类型。 try { - inputDevice.getKeyboardType(1, (error, number) => { + inputDevice.getKeyboardType(1, (error, type) => { if (error) { - console.log(`Failed to get keyboardtype. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } - console.log("The keyboard type of the device is: " + number); + console.log(`Keyboard type: ${JSON.stringify(type)}`); }); } catch (error) { - console.info("getKeyboardType " + error.code + " " + error.message); + console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -428,39 +431,45 @@ try { getKeyboardType(deviceId: number): Promise<KeyboardType> -查询输入设备的键盘类型,使用Promise方式作为异步方法。 +获取输入设备的键盘类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice +**参数**: + +| 参数 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。 | + **返回值**: -| 参数 | 说明 | -| ---------------------------------------- | ------------------- | -| Promise<[KeyboardType](#keyboardtype9)> | Promise实例,用于异步获取结果。 | +| 参数 | 说明 | +| --------------------------------------------- | ------------------------------- | +| Promise<[KeyboardType](#keyboardtype9)> | Promise对象,异步返回查询结果。 | **示例**: ```js // 示例查询设备id为1的设备键盘类型。 try { - inputDevice.getKeyboardType(1).then((number) => { - console.log("The keyboard type of the device is: " + number); + inputDevice.getKeyboardType(1).then((type) => { + console.log(`Keyboard type: ${JSON.stringify(type)}`); }); } catch (error) { - console.info("getKeyboardType " + error.code + " " + error.message); + console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## DeviceListener9+ -输入设备的描述信息。 +输入设备热插拔的描述信息。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice -| 名称 | 参数类型 | 说明 | -| -------- | --------------------------- | --------------------------------- | -| type | [ChangedType](#changedtype) | 表示输入设备插入或者移除。 | -| deviceId | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | +| 名称 | 参数类型 | 说明 | +| -------- | --------------------------- | ------------------------------------------------------------ | +| type | [ChangedType](#changedtype) | 输入设备插入或者移除。 | +| deviceId | number | 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。 | ## InputDeviceData @@ -468,18 +477,18 @@ try { **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice -| 名称 | 参数类型 | 说明 | -| -------------------- | -------------------------------------- | ---------------------------------------- | -| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | -| name | string | 输入设备的名字。 | +| 名称 | 参数类型 | 说明 | +| -------------------- | -------------------------------------- | ------------------------------------------------------------ | +| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。 | +| name | string | 输入设备的名字。 | | sources | Array<[SourceType](#sourcetype)> | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 | -| axisRanges | Array<[axisRanges](#axisrange)> | 输入设备的轴信息。 | -| bus9+ | number | 输入设备的总线类型。 | -| product9+ | number | 输入设备的产品信息。 | -| vendor9+ | number | 输入设备的厂商信息。 | -| version9+ | number | 输入设备的版本信息。 | -| phys9+ | string | 输入设备的物理地址。 | -| uniq9+ | string | 输入设备的唯一标识。 | +| axisRanges | Array<[axisRanges](#axisrange)> | 输入设备的轴信息。 | +| bus9+ | number | 输入设备的总线类型。 | +| product9+ | number | 输入设备的产品信息。 | +| vendor9+ | number | 输入设备的厂商信息。 | +| version9+ | number | 输入设备的版本信息。 | +| phys9+ | string | 输入设备的物理地址。 | +| uniq9+ | string | 输入设备的唯一标识。 | ## AxisType9+ @@ -517,7 +526,7 @@ try { ## SourceType -定义这个轴的输入源类型。比如鼠标设备可上报x轴事件,则x轴的源就是鼠标。 +轴的输入源类型。比如鼠标设备可上报x轴事件,则x轴的输入源就是鼠标。 **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice diff --git a/zh-cn/application-dev/reference/apis/js-apis-pointer.md b/zh-cn/application-dev/reference/apis/js-apis-pointer.md index 6a9c09f1a21e7d18e21643085d2023eabd21ef85..44cfe78aeed2ed070e4e8a09f40f9ae23de26377 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pointer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pointer.md @@ -1,6 +1,6 @@ # 鼠标指针 -鼠标指针管理模块,用于提供鼠标指针相关属性接口。 +鼠标指针管理模块,用于查询和设置鼠标指针相关属性。 > **说明**: > @@ -12,11 +12,11 @@ import pointer from '@ohos.multimodalInput.pointer'; ``` -## pointer.setPointerVisibele9+ +## pointer.setPointerVisible9+ setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void -设置鼠标指针显示或者隐藏,使用callback异步回调。 +设置鼠标指针显示或者隐藏,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -24,18 +24,22 @@ setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void | 参数 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------- | -| visible | boolean | 是 | 鼠标指针显示或者隐藏状态,true: 鼠标指针显示; false: 鼠标指针隐藏。 | -| callback | AsyncCallback<void> | 是 | 回调函数。当设置鼠标显示或隐藏成功,err为undefined,否则为错误对象。 | +| visible | boolean | 是 | 鼠标指针是否显示。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```js try { - pointer.setPointerVisible(true, (err, data) => { + pointer.setPointerVisible(true, (error) => { + if (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } console.log(`Set pointer visible success`); }); -} catch (err) { - console.log(`Set pointer visible failed. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); +} catch (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -43,7 +47,7 @@ try { setPointerVisible(visible: boolean): Promise<void> -设置鼠标指针显示或者隐藏,使用Promise方式作为异步方法。 +设置鼠标指针显示或者隐藏,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -51,23 +55,23 @@ setPointerVisible(visible: boolean): Promise<void> | 参数 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ---------------------------------------- | -| visible | boolean | 是 | 鼠标指针显示或者隐藏状态,true: 鼠标指针显示; false: 鼠标指针隐藏。 | +| visible | boolean | 是 | 鼠标指针是否显示。 | **返回值**: | 参数 | 说明 | | ------------------- | ------------------- | -| Promise<void> | Promise实例,用于异步获取结果。 | +| Promise<void> | Promise对象。 | **示例**: ```js try { - pointer.setPointerVisible(false).then(data => { - console.log(`Set mouse pointer visible success`); + pointer.setPointerVisible(false).then(() => { + console.log(`Set pointer visible success`); }); -} catch { - console.log(`Set mouse pointer visible failed err=${JSON.stringify(data)}, msg=${JSON.stringify(message)}`); +} catch (error) { + console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -75,7 +79,7 @@ try { isPointerVisible(callback: AsyncCallback<boolean>): void -获取鼠标指针显示或隐藏状态,使用callback异步回调。 +获取鼠标指针显示或隐藏状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -83,17 +87,21 @@ isPointerVisible(callback: AsyncCallback<boolean>): void | 参数 | 类型 | 必填 | 说明 | | -------- | ---------------------------- | ---- | -------------- | -| callback | AsyncCallback<boolean> | 是 | 回调函数,异步返回查询结果。 | +| callback | AsyncCallback<boolean> | 是 | 回调函数,异步返回鼠标指针显示或隐藏状态。 | **示例**: ```js try { - pointer.isPointerVisible(visible, (err, data) => { - console.log(`The mouse pointer visible attributes is ` + visible); + pointer.isPointerVisible((error, visible) => { + if (error) { + console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); }); -} catch (err) { - console.log(`The mouse pointer visible attributes is failed. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); +} catch (error) { + console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -101,7 +109,7 @@ try { isPointerVisible(): Promise<boolean> -获取鼠标指针显示或隐藏状态,使用Promise方式作为异步方法。 +获取鼠标指针显示或隐藏状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -109,25 +117,21 @@ isPointerVisible(): Promise<boolean> | 参数 | 说明 | | ---------------------- | ------------------- | -| Promise<boolean> | Promise实例,用于异步获取结果。 | +| Promise<boolean> | Promise对象,异步返回鼠标指针显示或隐藏状态。 | **示例**: ```js -try { - pointer.isPointerVisible().then((data) => { - console.log(`The mouse pointer visible attributes is success. data=${JSON.stringify(data)}`); - }); -} catch (err) { - ponsole.info(`The mouse pointer visible attributes is failed. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); -} +pointer.isPointerVisible().then((visible) => { + console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); +}); ``` ## pointer.setPointerSpeed9+ setPointerSpeed(speed: number, callback: AsyncCallback<void>): void -设置鼠标移动速度,使用callback异步回调。 +设置鼠标移动速度,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -135,18 +139,22 @@ setPointerSpeed(speed: number, callback: AsyncCallback<void>): void | 参数 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | -| speed | number | 是 | 鼠标移动速度设置挡位值1-11,最大值:11,最小值:1,标准值:5。 | -| callback | AysncCallback<void> | 是 | 回调函数。当设置鼠标速度成功,err为undefined,否则为错误对象。 | +| speed | number | 是 | 鼠标移动速度,范围1-11,默认为5。 | +| callback | AysncCallback<void> | 是 | 回调函数。 | **示例**: ```js try { - pointer.setPointerSpeed(5, (err, data) => { + pointer.setPointerSpeed(5, (error) => { + if (error) { + console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } console.log(`Set pointer speed success`); }); } catch (err) { - console.log(`Set pointer speed failed. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); + console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -154,7 +162,7 @@ try { setPointerSpeed(speed: number): Promise<void> -设置鼠标移动速度,使用Promise异步回调。 +设置鼠标移动速度,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -162,23 +170,23 @@ setPointerSpeed(speed: number): Promise<void> | 参数 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | -| speed | number | 是 | 鼠标移动速度设置挡位值1-11,最大值:11,最小值:1,标准值:5。 | +| speed | number | 是 | 鼠标移动速度,范围1-11,默认为5。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | -| Promise<void> | 无返回结果的Promise对象。 | +| Promise<void> | Promise对象。 | **示例**: ```js try { - pointer.setPointerSpeed(5).then(data => { + pointer.setPointerSpeed(5).then(() => { console.log(`Set pointer speed success`); }); -} catch (err) { - console.log(`Set pointer speed failed err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); +} catch (error) { + console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -186,7 +194,7 @@ try { getPointerSpeed(callback: AsyncCallback<number>): void -获取当前鼠标移动速度,使用callback异步回调。 +获取鼠标移动速度,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -194,17 +202,21 @@ getPointerSpeed(callback: AsyncCallback<number>): void | 参数 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | -| callback | AsyncCallback<number> | 是 | 回调函数,异步返回查询结果。 | +| callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标移动速度。 | **示例**: ```js try { - pointer.getPointerSpeed(speed, (err, data) => { - console.log(`The pointer speed is ` + speed); + pointer.getPointerSpeed(speed, (error, speed) => { + if (error) { + console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); }); } catch (err) { - console.log(`Failed to get the pointer speed. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); + console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -212,7 +224,7 @@ try { getPointerSpeed(): Promise<number> -获取当前鼠标移动速度,使用Promise异步回调。 +获取当前鼠标移动速度,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -220,17 +232,17 @@ getPointerSpeed(): Promise<number> | 参数 | 说明 | | --------------------- | ------------------- | -| Promise<number> | Promise实例,用于异步获取结果。 | +| Promise<number> | Promise实例,异步返回鼠标移动速度。 | **示例**: ```js try { - pointer.getPointerSpeed().then(data => { - console.log(`Get pointer speed success. data=${JSON.stringify(data)}`); + pointer.getPointerSpeed().then(speed => { + console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); }); -} catch (err) { - console.log(`Get pointer speed failed err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); +} catch (error) { + console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -238,7 +250,7 @@ try { getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void -获取鼠标样式类型,使用callback异步回调。 +获取鼠标样式类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -246,29 +258,27 @@ getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): | 参数 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | -------------- | -| windowId | number | 是 | 输入设备的窗口id。 | -| callback | AsyncCallback<[PointerStyle](#pointerstyle9)> | 是 | 回调函数,异步返回查询结果。 | +| windowId | number | 是 | 窗口id。 | +| callback | AsyncCallback<[PointerStyle](#pointerstyle9)> | 是 | 回调函数,异步返回鼠标样式类型。 | **示例**: ```js -// 获取设备的鼠标样式。 import window from '@ohos.window'; -var windowClass = null; -window.getTopWindow((err, data) => { - windowClass = data; - windowClass.getProperties((err, data) => { - var windowId = data.id; + +window.getTopWindow((error, win) => { + win.getProperties((error, properties) => { + var windowId = properties.id; if (windowId < 0) { console.log(`Invalid windowId`); return; } try { - pointer.getPointerStyle(windowId, (err, ret) => { - console.log(`The mouse pointer style is: ` + ret); + pointer.getPointerStyle(windowId, (error, style) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); }); - } catch (err) { - console.log(`Failed to get the pointer style. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); + } catch (error) { + console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } }); }); @@ -278,7 +288,7 @@ window.getTopWindow((err, data) => { getPointerStyle(windowId: number): Promise<PointerStyle> -获取鼠标样式类型,使用Promise方式作为异步方法。 +获取鼠标样式类型,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -286,28 +296,26 @@ getPointerStyle(windowId: number): Promise<PointerStyle> | 参数 | 说明 | | ---------------------------------------- | ------------------- | -| Promise<[PointerStyle](#pointerstyle9)> | Promise实例,用于异步获取结果。 | +| Promise<[PointerStyle](#pointerstyle9)> | Promise实例,异步返回鼠标样式类型。 | **示例**: ```js -// 获取设备的鼠标样式。 import window from '@ohos.window'; -var windowClass = null; -window.getTopWindow((err, data) => { - windowClass = data; - windowClass.getProperties((err, data) => { - var windowId = data.id; + +window.getTopWindow((error, win) => { + win.getProperties((error, properties) => { + var windowId = properties.id; if (windowId < 0) { console.log(`Invalid windowId`); return; } try { - pointer.getPointerStyle(windowId).then((ret) => { - console.log(`The mouse pointer style is: ` + ret); + pointer.getPointerStyle(windowId).then((style) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); }); - } catch (err) { - console.log(`Get pointer style failed err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); + } catch (error) { + console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } }); }); @@ -317,7 +325,7 @@ window.getTopWindow((err, data) => { setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void -设置鼠标的样式类型,使用callback异步回调。 +设置鼠标样式类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -325,30 +333,28 @@ setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCal | 参数 | 类型 | 必填 | 说明 | | ------------ | ------------------------------ | ---- | ----------------------------------- | -| windowId | number | 是 | 输入设备的窗口id。 | +| windowId | number | 是 | 窗口id。 | | pointerStyle | [PointerStyle](#pointerstyle9) | 是 | 鼠标样式id。 | -| callback | AysncCallback<void> | 是 | 回调函数。当设置样式成功,err为undefined,否则为错误对象。 | +| callback | AysncCallback<void> | 是 | 回调函数。 | **示例**: ```js -// 设置设备的鼠标样式。 import window from '@ohos.window'; -var windowClass = null; -window.getTopWindow((err, data) => { - windowClass = data; - windowClass.getProperties((err, data) => { - var windowId = data.id; + +window.getTopWindow((error, win) => { + win.getProperties((error, properties) => { + var windowId = properties.id; if (windowId < 0) { console.log(`Invalid windowId`); return; } try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, (err) => { - console.log(`Successfully set mouse pointer style`); + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { + console.log(`Set pointer style success`); }); - } catch (err) { - console.log(`Failed to set the pointer style. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); + } catch (error) { + console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } }); }); @@ -357,7 +363,7 @@ window.getTopWindow((err, data) => { setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void> -设置鼠标的样式类型,使用Promise方式作为异步方法。 +设置鼠标样式类型,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -365,37 +371,35 @@ setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void&g | 参数 | 类型 | 必填 | 说明 | | ------------------- | ------------------------------ | ---- | ---------------- | -| windowId | number | 是 | 输入设备的窗口id。 | +| windowId | number | 是 | 窗口id。 | | pointerStyle | [PointerStyle](#pointerstyle9) | 是 | 鼠标样式id。 | -| Promise<void> | void | 是 | 无返回结果的Promise对象。 | +| Promise<void> | void | 是 | Promise对象。 | **示例**: ```js -// 设置设备的鼠标样式。 import window from '@ohos.window'; -var windowClass = null; -window.getTopWindow((err, data) => { - windowClass = data; - windowClass.getProperties((err, data) => { - var windowId = data.id; + +window.getTopWindow((error, win) => { + win.getProperties((error, properties) => { + var windowId = properties.id; if (windowId < 0) { console.log(`Invalid windowId`); return; } try { pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { - console.log(`Successfully set mouse pointer style`); + console.log(`Set pointer style success`); }); - } catch (err) { - console.log(`Failed to set the pointer style. err=${JSON.stringify(err)}, msg=${JSON.stringify(message)}`); + } catch (error) { + console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } }); }); ``` ## PointerStyle9+ -定义鼠标样式类型。 +鼠标样式类型。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer @@ -439,6 +443,4 @@ window.getTopWindow((err, data) => { | MIDDLE_BTN_NORTH_WEST | 35 | 向西北滚动 | | MIDDLE_BTN_SOUTH_EAST | 36 | 向东南滚动 | | MIDDLE_BTN_SOUTH_WEST | 37 | 向西南滚动 | -| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | 四向锥形移动 | - - +| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | 四向锥形移动 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/alphabet.gif b/zh-cn/application-dev/reference/arkui-ts/figures/alphabet.gif new file mode 100644 index 0000000000000000000000000000000000000000..a868febbcb800d9d0df0d3bfcaf57c64e570eb8a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/alphabet.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animateTo.gif b/zh-cn/application-dev/reference/arkui-ts/figures/animateTo.gif new file mode 100644 index 0000000000000000000000000000000000000000..8755e2bc014f3843f8798acae725eeb0fee11f54 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/animateTo.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/animation.PNG new file mode 100644 index 0000000000000000000000000000000000000000..92f92e0001a90840d03ebd00e0b0ef736c2a94c8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/animation.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif b/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif new file mode 100644 index 0000000000000000000000000000000000000000..6cfbc07fc5122be3ecd69e6b33b6f00c0f676a0f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation1.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/animation1.PNG new file mode 100644 index 0000000000000000000000000000000000000000..98cc1fa8c0537071549fa8185fa14f7ad103e7f8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/animation1.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/button.gif b/zh-cn/application-dev/reference/arkui-ts/figures/button.gif new file mode 100644 index 0000000000000000000000000000000000000000..04ab6ed97635118a7ffd3fb9d6be666f2ac40691 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/button.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/clipAndMask.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/clipAndMask.PNG new file mode 100644 index 0000000000000000000000000000000000000000..6f522bf5a01241f67ad8c493a04f3d9d71aa9be5 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/clipAndMask.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/flex.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/flex.PNG new file mode 100644 index 0000000000000000000000000000000000000000..ccfb5020729aa765d259afd74fc93822c5752f4d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/flex.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/shared.gif b/zh-cn/application-dev/reference/arkui-ts/figures/shared.gif new file mode 100644 index 0000000000000000000000000000000000000000..d43a6a38d9516945efc3ed80f4f1592c94645952 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/shared.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/swiper.gif b/zh-cn/application-dev/reference/arkui-ts/figures/swiper.gif new file mode 100644 index 0000000000000000000000000000000000000000..692ac1398e1c98217a7466c66b1a3b873165a7ee Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/swiper.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/tabContent.gif b/zh-cn/application-dev/reference/arkui-ts/figures/tabContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..088045f41a884700791adf9fd6709f239c3269c0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/tabContent.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174582844.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174582844.gif index 30e89347337d9e358d4b823c7658490e032eb435..639261bd9e9997074cd45491807a58bb79a5def2 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174582844.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174582844.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001186807708.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001186807708.gif index 8eceb3bf5313485a1fedda5768e70cdb5febc464..c2468d1491af049673574a097a107a3e6c1b417d 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001186807708.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001186807708.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001241668363.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001241668363.gif index 502888c25bb21b3803858f9c436cca23d9dc29d0..fba237dad5fc43609bb5ebcf6b0310328800d9f6 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001241668363.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001241668363.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001251007721.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001251007721.gif index 32d2334360f9fd90afd1709f50a39add4e2196c1..3c7f41bb43465b26d9545482a6c42621a42b360b 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001251007721.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001251007721.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md index 7139f0fad8e3df8ec21e83e443150b23e8273ec3..adfe8558de0cf3cac1ec2cbe908c18c75a11f0ab 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -73,3 +73,5 @@ struct AttrAnimationExample { } } ``` + +![animation](figures/animation.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md index e1214c92ca2e17e33b7fee457deff31f38ef20a1..c072a4cf54fec80813302d637c748ca382a60306 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -30,10 +30,10 @@ **参数:** - | 参数名 | 参数类型 | 必填 | 参数描述 | - | ------- | ----------------------------------- | ---- | ------------- | - | label | [ResourceStr](ts-types.md#resourcestr) | 否 | 按钮文本内容。 | - | options | { type?: ButtonType, stateEffect?: boolean } | 否 | 见方法1参数说明。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------- | ----------------------------------- | ---- | ------------- | +| label | [ResourceStr](ts-types.md#resourcestr) | 否 | 按钮文本内容。 | +| options | { type?: ButtonType, stateEffect?: boolean } | 否 | 见方法1参数说明。 | ## 属性 @@ -89,9 +89,6 @@ struct ButtonExample { Text('loading').fontSize(12).fontColor(0xffffff).margin({ left: 5, right: 12 }) }.alignItems(VerticalAlign.Center).width(90).height(40) }.backgroundColor(0x317aff) - .onClick((event: ClickEvent) => { - AlertDialog.show({ message: 'The login is successful' }) - }) Button('Disable', { type: ButtonType.Capsule, stateEffect: false }).opacity(0.4) .backgroundColor(0x317aff).width(90) @@ -112,3 +109,4 @@ struct ButtonExample { } ``` +![button](figures/button.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md index defe3b04193661870318afbc1c0980928c3bad33..7437c6f33f8f96175ee6e81101ebe75d08cf09f1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md @@ -7,10 +7,6 @@ > 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - - - - ## 子组件 无 @@ -55,58 +51,34 @@ DatePicker(options?: {start?: Date, end?: Date, selected?: Date}) ## 示例 -### 日期选择器(显示农历) - ```ts // xxx.ets @Entry @Component -struct DatePickerExample01 { +struct DatePickerExample { + @State isLunar: boolean = false private selectedDate: Date = new Date('2021-08-08') build() { Column() { + Button('切换公历农历') + .margin({ top: 30 }) + .onClick(() => { + this.isLunar = !this.isLunar + }) DatePicker({ start: new Date('1970-1-1'), end: new Date('2100-1-1'), selected: this.selectedDate, }) - .lunar(true) - .onChange((date: DatePickerResult) => { - console.info('select current date is: ' + JSON.stringify(date)) - }) - }.width('100%') - } -} -``` - -![zh-cn_image_0000001251279761](figures/zh-cn_image_0000001251279761.gif) - - -### 日期选择器(不显示农历) - -```ts -// xxx.ets -@Entry -@Component -struct DatePickerExample02 { - private selectedDate: Date = new Date('2021-08-08') + .lunar(this.isLunar) + .onChange((value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info('select current date is: ' + JSON.stringify(value)) + }) - build() { - Column() { - DatePicker({ - start: new Date('1970-1-1'), - end: new Date('2100-1-1'), - selected: this.selectedDate, - }) - .lunar(false) - .onChange((date: DatePickerResult) => { - console.info('select current date is: ' + JSON.stringify(date)) - }) }.width('100%') } } ``` -![zh-cn_image_0000001251092975](figures/zh-cn_image_0000001251092975.gif) - diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md index 37f7c25716f2de0c46e17ae1d99b94e6ab50b368..093c1bdb030158432a30ce8c99e21d61f89e3a55 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md @@ -22,8 +22,8 @@ ImageAnimator() | 参数名称 | 参数类型 |参数描述 | | ---------- | ----------------------- |-------- | -| images | Array<[ImageFrameInfo](imageframeinfo对象说明)> | 设置图片帧信息集合。每一帧的帧信息(ImageFrameInfo)包含图片路径、图片大小、图片位置和图片播放时长信息,详见ImageFrameInfo属性说明。
默认值:[] | -| state | [AnimationStatus](ts-appendix-enums.md#animationstatus) |默认为初始状态,用于控制播放状态。
默认值:AnimationStatus.Initial | +| images | Array<[ImageFrameInfo](#imageframeinfo对象说明)> | 设置图片帧信息集合。每一帧的帧信息(ImageFrameInfo)包含图片路径、图片大小、图片位置和图片播放时长信息,详见ImageFrameInfo属性说明。
默认值:[] | +| state | [AnimationStatus](ts-appendix-enums.md#animationstatus) | 默认为初始状态,用于控制播放状态。
默认值:AnimationStatus.Initial | | duration | number | 单位为毫秒,默认时长为1000ms;duration为0时,不播放图片;值的改变只会在下一次循环开始时生效;当images中任意一帧图片设置了单独的duration后,该属性设置无效。
默认值:1000 | | reverse | boolean | 设置播放顺序。false表示从第1张图片播放到最后1张图片; true表示从最后1张图片播放到第1张图片。
默认值:false | | fixedSize | boolean | 设置图片大小是否固定为组件大小。 true表示图片大小与组件大小一致,此时设置图片的width 、height 、top 和left属性是无效的。false表示每一张图片的width 、height 、top和left属性都要单独设置。
默认值:true | @@ -49,7 +49,7 @@ ImageAnimator() | -------- | -------- | | onStart(event: () => void) | 状态回调,动画开始播放时触发。 | | onPause(event: () => void) | 状态回调,动画暂停播放时触发。 | -| onRepeat(event: () => void) | 状态回调,动画重新播放时触发。 | +| onRepeat(event: () => void) | 状态回调,动画重复播放时触发。 | | onCancel(event: () => void) | 状态回调,动画取消播放时触发。 | | onFinish(event: () => void) | 状态回调,动画播放完成时触发。 | @@ -66,47 +66,46 @@ struct ImageAnimatorExample { @State iterations: number = 1 build() { - Column({ space:5 }) { + Column({ space: 10 }) { ImageAnimator() .images([ - { - // comment文件夹与pages同级 - src: '/comment/bg1.jpg', + { + src: $r('app.media.img1'), duration: 500, - width: 325, - height: 200, + width: 170, + height: 120, top: 0, left: 0 }, { - src: '/comment/bg2.jpg', + src: $r('app.media.img2'), duration: 500, - width: 325, - height: 200, + width: 170, + height: 120, top: 0, - left: 0 + left: 170 }, { - src: $r('app.media.bg3'), + src: $r('app.media.img3'), duration: 500, - width: 325, - height: 200, - top: 0, - left: 0 + width: 170, + height: 120, + top: 120, + left: 170 }, { - src: $rawfile('bg4.jpg'), + src: $r('app.media.img4'), duration: 500, - width: 325, - height: 200, - top: 0, + width: 170, + height: 120, + top: 120, left: 0 } ]) .state(this.state).reverse(this.reverse).fixedSize(false).preDecode(2) - .fillMode(FillMode.None).iterations(this.iterations).width(325).height(210) - .margin({top:100}) - .onStart(() => { // 当帧动画开始播放后触发 + .fillMode(FillMode.None).iterations(this.iterations).width(340).height(240) + .margin({ top: 100 }) + .onStart(() => { console.info('Start') }) .onPause(() => { @@ -118,35 +117,34 @@ struct ImageAnimatorExample { .onCancel(() => { console.info('Cancel') }) - .onFinish(() => { // 当帧动画播放完成后触发 - this.state = AnimationStatus.Stopped + .onFinish(() => { console.info('Finish') }) Row() { Button('start').width(100).padding(5).onClick(() => { this.state = AnimationStatus.Running - }) + }).margin(5) Button('pause').width(100).padding(5).onClick(() => { - this.state = AnimationStatus.Paused - }) + this.state = AnimationStatus.Paused // 显示当前帧图片 + }).margin(5) Button('stop').width(100).padding(5).onClick(() => { - this.state = AnimationStatus.Stopped - }) + this.state = AnimationStatus.Stopped // 显示动画的起始帧图片 + }).margin(5) } + Row() { Button('reverse').width(100).padding(5).onClick(() => { this.reverse = !this.reverse - }) + }).margin(5) Button('once').width(100).padding(5).onClick(() => { this.iterations = 1 - }) - Button('iteration').width(100).padding(5).onClick(() => { - this.iterations = -1 - }) + }).margin(5) + Button('infinite').width(100).padding(5).onClick(() => { + this.iterations = -1 // 无限循环播放 + }).margin(5) } - }.width('100%').height('100%').backgroundColor(0xF1F3F5) + }.width('100%').height('100%') } } ``` -![zh-cn_image_0000001219662643](figures/zh-cn_image_0000001219662643.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md index d3201827e9f9528d5b449a760534c996958e5ab5..d03b65792c3c407408870796225e0bbada42f951 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md @@ -65,9 +65,9 @@ stop() @Entry @Component struct Second { - @State accumulateTime: number = 0; + @State accumulateTime: number = 0 // 导入对象 - controller: TextClockController = new TextClockController(); + controller: TextClockController = new TextClockController() build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text('Current milliseconds is ' + this.accumulateTime) @@ -76,7 +76,7 @@ struct Second { TextClock({ timeZoneOffset: -8, controller: this.controller }) .format('hms') .onDateChange((value: number) => { - this.accumulateTime = value; + this.accumulateTime = value }) .margin(20) .fontSize(30) @@ -84,12 +84,12 @@ struct Second { .margin({ bottom: 10 }) .onClick(() => { // 启动文本时钟 - this.controller.start(); + this.controller.start() }) Button("stop TextClock") .onClick(() => { // 停止文本时钟 - this.controller.stop(); + this.controller.stop() }) } .width('100%') diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md index feea880eb6a5486c8bbf2263ecfdc93bcb520ed6..6a85cfa4b5e25080a61ffabfb1bcc05660b802bd 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md @@ -1,6 +1,6 @@ # TextPicker -滚动选择文本的组件。 +滑动选择文本内容的组件。 > **说明:** > @@ -23,14 +23,14 @@ TextPicker(options?: {range: string[]|Resource, selected?: number, value?: strin | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | | range | string[] \| [Resource](ts-types.md#resource类型) | 是 | 选择器的数据选择列表。 | -| selected | number | 否 | 设置默认选中项在数组中的index值。
默认值:0 | +| selected | number | 否 | 设置默认选中项在数组中的索引值。
默认值:0 | | value | string | 否 | 设置默认选中项的值,优先级低于selected。
默认值:第一个元素值 | ## 属性 | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| defaultPickerItemHeight | number \| string | 默认Picker内容项元素高度。 | +| defaultPickerItemHeight | number \| string | 设置Picker各选择项的高度。 | ## 事件 @@ -53,7 +53,7 @@ struct TextPickerExample { build() { Column() { - TextPicker({range: this.fruits, selected: this.select}) + TextPicker({ range: this.fruits, selected: this.select }) .onChange((value: string, index: number) => { console.info('Picker item changed, value: ' + value + ', index: ' + index) }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md index d5e0b6879170894cd859e1882783c798a6afeb76..8396476e8ad0867408a4cd801fd7d65e9758a88c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md @@ -71,11 +71,11 @@ reset() @Component struct TextTimerExample { textTimerController: TextTimerController = new TextTimerController() - @State format: string = 'HH:mm:ss.SS' + @State format: string = 'mm:ss.SS' build() { Column() { - TextTimer({controller: this.textTimerController}) + TextTimer({ controller: this.textTimerController, isCountDown: true, count: 30000 }) .format(this.format) .fontColor(Color.Black) .fontSize(50) @@ -84,14 +84,14 @@ struct TextTimerExample { }) Row() { Button("start").onClick(() => { - this.textTimerController.start(); - }); + this.textTimerController.start() + }) Button("pause").onClick(() => { - this.textTimerController.pause(); - }); + this.textTimerController.pause() + }) Button("reset").onClick(() => { - this.textTimerController.reset(); - }); + this.textTimerController.reset() + }) } } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md index 13855a9815cc2ab0ba23ca1e3b0c5c02c2cc8d62..5fe82d03d5c5180727483648a4882153c6812322 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md @@ -1,6 +1,6 @@ # TimePicker -滚动选择时间的组件。 +滑动选择时间的组件。 > **说明:** > @@ -16,7 +16,7 @@ TimePicker(options?: {selected?: Date}) -默认以00:00至23:59的时间区间创建滑动选择器。 +默认以24小时的时间区间创建滑动选择器。 **参数:** @@ -55,20 +55,25 @@ TimePicker(options?: {selected?: Date}) @Entry @Component struct TimePickerExample { + @State isMilitaryTime: boolean = false private selectedTime: Date = new Date('2022-07-22T08:00:00') build() { Column() { + Button('切换12小时制/24小时制') + .margin({ top: 30 }) + .onClick(() => { + this.isMilitaryTime = !this.isMilitaryTime + }) TimePicker({ selected: this.selectedTime, }) - .useMilitaryTime(true) - .onChange((date: TimePickerResult) => { - console.info('select current date is: ' + JSON.stringify(date)) - }) + .useMilitaryTime(this.isMilitaryTime) + .onChange((value: TimePickerResult) => { + this.selectedTime.setHours(value.hour, value.minute) + console.info('select current date is: ' + JSON.stringify(value)) + }) }.width('100%') } } ``` - -![zh-cn_image_0000001251292933](figures/zh-cn_image_0000001251292933.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index 3928f356b22cc0066f87e55ad2ebd6ea136ff530..bf56800c5b2345d524b0d321b9986e3a0dbb99d6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -23,7 +23,7 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) | 参数名 | 参数类型 | 必填 | 参数描述 | | ---- | ---------- | -----| -------------- | -| type | ToggleType | 是 | 开关类型。 | +| type | [ToggleType](#toggletype枚举说明) | 是 | 开关类型。 | | isOn | boolean | 否 | 开关是否打开,true:打开,false:关闭。
默认值:false | 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 60ea9a024d52626e00e67e5ba4fd7f27ae89043e..b4ba444f881be19c4be8bc5f5a422e3c0f3ec2d2 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 @@ -162,3 +162,4 @@ struct AlphabetIndexerSample { } ``` +![alphabet](figures/alphabet.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md index 7e03805a45bfb67da494a67a7025450c05ffa42f..43487f3c6d291a02fdc8526423500110b6887bc8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md @@ -61,8 +61,8 @@ @Entry @Component struct BadgeExample { - @State counts: number = 1; - @State message: string = 'new'; + @State counts: number = 1 + @State message: string = 'new' build() { Column() { @@ -77,7 +77,7 @@ struct BadgeExample { }) { Button('message') .onClick(() => { - this.counts++; + this.counts++ }) .width(100).height(50).backgroundColor(0x317aff) }.width(100).height(50) @@ -91,7 +91,7 @@ struct BadgeExample { }) { Button('message') .onClick(() => { - this.counts++; + this.counts++ }) .width(100).height(50).backgroundColor(0x317aff) }.width(100).height(50) @@ -106,7 +106,7 @@ struct BadgeExample { }) { Button('message') .onClick(() => { - this.counts++; + this.counts++ }) .width(100).height(50).backgroundColor(0x317aff) }.width(100).height(50) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md index c9f266eca7e1405e6c2d997bbc9ea73f39ad20ba..b04c09c7804046cfdce174a35b9291371f34ffaa 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md @@ -1,10 +1,10 @@ # Flex -应用弹性方式布局子组件的容器组件。 +以弹性方式布局子组件的容器组件。 > **说明:** > - 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 -> - Flex组件在设置flexShrink、flexGrow时存在二次布局过程,因此在对性能有严格要求的场景下建议使用[Column](ts-container-column.md)、[Row](ts-container-row.md)代替。 +> - Flex组件在渲染时存在二次布局过程,因此在对性能有严格要求的场景下建议使用[Column](ts-container-column.md)、[Row](ts-container-row.md)代替。 ## 权限列表 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-navigator.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-navigator.md index 59b184476c6458269984d678abb4df476e9b576c..a5c39cd63bb5a4d76bf939a4748781b1187ebace 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-navigator.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-navigator.md @@ -49,21 +49,21 @@ Navigator(value?: {target: string, type?: NavigationType}) @Entry @Component struct NavigatorExample { - @State active: boolean = false; + @State active: boolean = false @State Text: object = {name: 'news'} build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Navigator({ target: 'pages/container/navigator/Detail', type: NavigationType.Push }) { Text('Go to ' + this.Text['name'] + ' page') - .width('100%').textAlign(TextAlign.Center) + .width('100%').textAlign(TextAlign.Center) }.params({ text: this.Text }) // 传参数到Detail页面 Navigator() { Text('Back to previous page').width('100%').textAlign(TextAlign.Center) }.active(this.active) .onClick(() => { - this.active = true; + this.active = true }) }.height(150).width(350).padding(35) } @@ -78,7 +78,7 @@ import router from '@ohos.router' @Component struct DetailExample { // 接收Navigator.ets的传参 - @State text: any = router.getParams().text; + @State text: any = router.getParams().text build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { @@ -87,7 +87,7 @@ struct DetailExample { } Text('This is ' + this.text['name'] + ' page') - .width('100%').textAlign(TextAlign.Center) + .width('100%').textAlign(TextAlign.Center) } .width('100%').height(200).padding({ left: 35, right: 35, top: 35 }) } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md index e567fe57f5126acc77059a759a43469bae1e22fa..ec239c8400514c7e41cb3b5f37cbee6afd6a0fb0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md @@ -58,7 +58,7 @@ Panel(show: boolean) | 名称 | 功能描述 | | -------- | -------- | | onChange(event: (width: number, height: number, mode: PanelMode) => void) | 当可滑动面板发生状态变化时触发, 返回的height值为内容区高度值,当dragbar属性为true时,panel本身的高度值为dragbar高度加上内容区高度。 | -| onHeightChange(callback: (value: number) => void)9+ |当可滑动面板发生高度变化时触发,返回的height值为内容区高度值,当dragbar属性为true时,panel本身的高度值为dragbar高度加上内容区高度。因用户体验设计原因,panel最高只能滑到 fullHeight-8vp。 | +| onHeightChange(callback: (value: number) => void)9+ |当可滑动面板发生高度变化时触发,返回的height值为内容区高度值,默认返回值单位为px。当dragbar属性为true时,panel本身的高度值为dragbar高度加上内容区高度。因用户体验设计原因,panel最高只能滑到 fullHeight-8vp。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md index 3ee143d2a165be8aef8e1b72df05461b5b021a00..b9d2e3f3300160393745c24a49bc8b3ac82b479b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md @@ -180,3 +180,5 @@ struct SwiperExample { } } ``` + +![swiper](figures/swiper.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md index 3d9639247408e19edc2f5614306cabf12a5e5080..ac63672ce50807e39794c19b9aef87d9be25728c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md @@ -113,3 +113,4 @@ struct TabContentExample { } ``` +![tabContent](figures/tabContent.gif) \ No newline at end of file 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 fec478c62d03e2ebcc3816c032b71e13f23d14f3..eef21726017bab7f983eaa66d92615778127de09 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 @@ -88,3 +88,11 @@ struct AnimateToExample { } } ``` + +示意图: + +![animation](figures/animation.PNG) + +点击第一个按钮播放改变按钮大小的动画,点击第二个按钮播放按钮顺时针旋转90度的动画。 + +![animation1](figures/animation1.PNG) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-action-sheet.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-action-sheet.md index b00ecd9c6be46ac428f017c744e1115b1a07cd35..eefeda849adbbaa2e4d9333f31da124de59ce010 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-action-sheet.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-action-sheet.md @@ -3,13 +3,9 @@ 列表弹窗。 > **说明:** -> 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 -## 权限 - -无 - ## ActionSheet.show @@ -21,10 +17,10 @@ show(value: { title: string | Resource, message: string  | 参数名 | 参数类型 | 必填 | 参数描述 | | ---------- | -------------------------- | ------- | ----------------------------- | -| title | string \| [Resource](ts-types.md#resource) | 是 | 弹窗标题。 | -| message | string \| [Resource](ts-types.md#resource) | 是 | 弹窗内容。 | +| title | [ResourceStr](ts-types.md#resourcestr) | 是 | 弹窗标题。 | +| message | [ResourceStr](ts-types.md#resourcestr) | 是 | 弹窗内容。 | | autoCancel | boolean | 否 | 点击遮障层时,是否关闭弹窗。
默认值:true | -| confirm | {
value: string \| [Resource](ts-types.md#resource),
action: () => void
} | 否 | 确认按钮的文本内容和点击回调。
默认值:
value:按钮文本内容。
action: 按钮选中时的回调。 | +| confirm | {
value: [ResourceStr](ts-types.md#resourcestr),
action: () => void
} | 否 | 确认按钮的文本内容和点击回调。
默认值:
value:按钮文本内容。
action: 按钮选中时的回调。 | | cancel | () => void | 否 | 点击遮障层关闭dialog时的回调。 | | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md#dialogalignment枚举说明) | 否 | 弹窗在竖直方向上的对齐方式。
默认值:DialogAlignment.Bottom | | offset | {
dx: Length,
dy: Length
} | 否 | 弹窗相对alignment所在位置的偏移量。{
dx: 0,
dy: 0
} | @@ -34,8 +30,8 @@ show(value: { title: string | Resource, message: string  | 参数名 | 参数类型 | 必填 | 参数描述 | | ------ | ------------------------------------------------------------ | ---- | ----------------- | -| title | string \| [Resource](ts-types.md#resource) | 是 | 选项的文本内容。 | -| icon | string \| [Resource](ts-types.md#resource) | 否 | 选项的图标,默认无图标显示。 | +| title | [ResourceStr](ts-types.md#resourcestr) | 是 | 选项的文本内容。 | +| icon | [ResourceStr](ts-types.md#resourcestr) | 否 | 选项的图标,默认无图标显示。 | | action | ()=>void | 是 | 选项选中的回调。 | @@ -43,7 +39,6 @@ show(value: { title: string | Resource, message: string  ```ts -// xxx.ets @Entry @Component struct ActionSheetExample { @@ -54,29 +49,35 @@ struct ActionSheetExample { ActionSheet.show({ title: 'ActionSheet title', message: 'message', + autoCancel: true, confirm: { value: 'Confirm button', action: () => { - console.log('Get Alert Dialog handled'); + console.log('Get Alert Dialog handled') } }, + cancel: () => { + console.log('actionSheet canceled') + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, sheets: [ { title: 'apples', action: () => { - console.log('apples'); + console.log('apples') } }, { title: 'bananas', action: () => { - console.log('bananas'); + console.log('bananas') } }, { title: 'pears', action: () => { - console.log('pears'); + console.log('pears') } } ] diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md index ffb54ddf303b00aa927bdc538a69dfd4022c9c66..4b3bdc23ba12b695df9873770610be0362a31628 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md @@ -11,7 +11,7 @@ | 名称 | 参数类型 | 参数描述 | | ---- | --------------- | -------- | -| show | AlertDialogParamWithConfirm \| AlertDialogParamWithButtons | 定义并显示AlertDialog组件。 | +| show | [AlertDialogParamWithConfirm](#alertdialogparamwithconfirm对象说明) \| [AlertDialogParamWithButtons](#alertdialogparamwithbuttons对象说明) | 定义并显示AlertDialog组件。 | ## AlertDialogParamWithConfirm对象说明 | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -19,11 +19,11 @@ | title | [ResourceStr](ts-types.md#resourcestr) | 否 | 弹窗标题。 | | message | [ResourceStr](ts-types.md#resourcestr) | 是 | 弹窗内容。 | | autoCancel | boolean | 否 | 点击遮障层时,是否关闭弹窗。
默认值:true | -| confirm | {
value: string \| [Resource](ts-types.md#resource),
fontColor?: Color \| number \| string \| [Resource](ts-types.md#resource),
backgroundColor?: Color \| number \| string \| [Resource](ts-types.md#resource),
action: () => void
} | 否 | 确认按钮的文本内容、文本色、按钮背景色和点击回调。 | +| confirm | {
value: [ResourceStr](ts-types.md#resourcestr),
fontColor?: [ResourceColor](ts-types.md#resourcecolor),
backgroundColor?:  [ResourceColor](ts-types.md#resourcecolor),
action: () => void
} | 否 | 确认按钮的文本内容、文本色、按钮背景色和点击回调。 | | cancel | () => void | 否 | 点击遮障层关闭dialog时的回调。 | | alignment | [DialogAlignment](#dialogalignment枚举说明) | 否 | 弹窗在竖直方向上的对齐方式。
默认值:DialogAlignment.Default | | offset | [Offset](ts-types.md#offset) | 否 | 弹窗相对alignment所在位置的偏移量。 | -| gridCount | number | 否 | 弹窗容器宽度所占用栅格数。
**说明:**
当gridCount小于等于0时,弹窗宽度是固定的;大于0时,按照设置的数值显示宽度,最大值为4,若值为小数,则向下取整。 | +| gridCount | number | 否 | 弹窗容器宽度所占用栅格数。 | ## AlertDialogParamWithButtons对象说明 | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -31,12 +31,12 @@ | title | [ResourceStr](ts-types.md#resourcestr) | 否 | 弹窗标题。 | | message | [ResourceStr](ts-types.md#resourcestr) | 是 | 弹窗内容。 | | autoCancel | boolean | 否 | 点击遮障层时,是否关闭弹窗。
默认值:true | -| primaryButton | {
value: string \| [Resource](ts-types.md#resource),
fontColor?: Color \| number \| string \| [Resource](ts-types.md#resource),
backgroundColor?: Color \| number \| string \| [Resource](ts-types.md#resource),
action: () => void;
} | 否 | 按钮的文本内容、文本色、按钮背景色和点击回调。 | -| secondaryButton | {
value: string \| [Resource](ts-types.md#resource),
fontColor?: Color \| number \| string \| [Resource](ts-types.md#resource),
backgroundColor?: Color \| number \| string \| [Resource](ts-types.md#resource),
action: () => void;
} | 否 | 按钮的文本内容、文本色、按钮背景色和点击回调。 | +| primaryButton | {
value: [ResourceStr](ts-types.md#resourcestr),
fontColor?: [ResourceColor](ts-types.md#resourcecolor),
backgroundColor?: [ResourceColor](ts-types.md#resourcecolor),
action: () => void;
} | 否 | 按钮的文本内容、文本色、按钮背景色和点击回调。 | +| secondaryButton | {
value: [ResourceStr](ts-types.md#resourcestr),
fontColor?: [ResourceColor](ts-types.md#resourcecolor),
backgroundColor?: [ResourceColor](ts-types.md#resourcecolor),
action: () => void;
} | 否 | 按钮的文本内容、文本色、按钮背景色和点击回调。 | | cancel | () => void | 否 | 点击遮障层关闭dialog时的回调。 | | alignment | [DialogAlignment](#dialogalignment枚举说明) | 否 | 弹窗在竖直方向上的对齐方式。
默认值:DialogAlignment.Default | | offset | [Offset](ts-types.md#offset) | 否 | 弹窗相对alignment所在位置的偏移量。 | -| gridCount | number | 否 | 弹窗容器宽度所占用栅格数。 | +| gridCount | number | 否 | 弹窗容器宽度所占用栅格数。 | ## DialogAlignment枚举说明 @@ -60,7 +60,6 @@ @Entry @Component struct AlertDialogExample { - build() { Column({ space: 5 }) { Button('one button dialog') @@ -69,6 +68,10 @@ struct AlertDialogExample { { title: 'title', message: 'text', + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 3, confirm: { value: 'button', action: () => { @@ -80,7 +83,7 @@ struct AlertDialogExample { } } ) - }) + }) .backgroundColor(0x317aff) Button('two button dialog') .onClick(() => { @@ -88,6 +91,10 @@ struct AlertDialogExample { { title: 'title', message: 'text', + autoCancel: true, + alignment: DialogAlignment.Bottom, + gridCount: 4, + offset: { dx: 0, dy: -20 }, primaryButton: { value: 'cancel', action: () => { @@ -105,7 +112,7 @@ struct AlertDialogExample { } } ) - }).backgroundColor(0x317aff) + }).backgroundColor(0x317aff) }.width('100%').margin({ top: 5 }) } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md index 13718d2dfa5aec6d4c78090b8e317037edc852ca..86965454a213ad5db466bdbf9e2e4ac8a1f6c8ba 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md @@ -22,25 +22,10 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, aut | cancel | () => void | 否 | 点击遮障层退出时的回调。 | | autoCancel | boolean | 否 | 是否允许点击遮障层退出。
默认值:true | | alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment枚举说明) | 否 | 弹窗在竖直方向上的对齐方式。
默认值:DialogAlignment.Default | -| offset | {
dx: Length \| [Resource](ts-types.md#resource),
dy: Length  \| [Resource](ts-types.md#resource)
} | 否 | 弹窗相对alignment所在位置的偏移量。 | +| offset | [Offset](ts-types.md#offset) | 否 | 弹窗相对alignment所在位置的偏移量。 | | customStyle | boolean | 否 | 弹窗容器样式是否自定义。
默认值:false | | gridCount8+ | number | 否 | 弹窗宽度占[栅格宽度](../../ui/ui-ts-layout-grid-container-new.md)的个数。 | -## DialogAlignment枚举说明 - -| 名称 | 描述 | -| ------------------------ | ------------------------------------------------------ | -| Top | 垂直顶部对齐。 | -| Center | 垂直居中对齐。 | -| Bottom | 垂直底部对齐。 | -| Default | 默认对齐。
**说明:**
与枚举值Center效果相同。 | -| TopStart8+ | 左上对齐。 | -| TopEnd8+ | 右上对齐。 | -| CenterStart8+ | 左中对齐。 | -| CenterEnd8+ | 右中对齐。 | -| BottomStart8+ | 左下对齐。 | -| BottomEnd8+ | 右下对齐。 | - ## CustomDialogController @@ -107,17 +92,28 @@ struct CustomDialogUser { @State textValue: string = '' @State inputValue: string = 'click me' dialogController: CustomDialogController = new CustomDialogController({ - builder: CustomDialogExample({ cancel: this.onCancel, confirm: this.onAccept, textValue: $textValue, inputValue: $inputValue }), + builder: CustomDialogExample({ + cancel: this.onCancel, + confirm: this.onAccept, + textValue: $textValue, + inputValue: $inputValue + }), cancel: this.existApp, - autoCancel: true + autoCancel: true, + alignment: DialogAlignment.Default, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false }) onCancel() { console.info('Callback when the first button is clicked') } + onAccept() { console.info('Callback when the second button is clicked') } + existApp() { console.info('Click the callback in the blank area') } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-menu.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-menu.md index df6b4f8b24e75937f0d1109893055cd3b00a03a5..25616026704a2146cdc171cd6ceb250a3aee3e79 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-menu.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-menu.md @@ -49,7 +49,7 @@ struct Index { .bindContextMenu(this.MenuBuilder, ResponseType.LongPress) .onDragStart(()=>{ // 拖拽时关闭菜单 - ContextMenu.close(); + ContextMenu.close() }) } .width('100%') diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md b/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md index c9f4cb0422c71be641d1ebc404597a5ca5fbcdfe..11fb2e197ce9d067af664db6c0b96028acce3663 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md @@ -2,7 +2,9 @@ 状态管理模块提供了应用程序的数据存储能力、持久化数据管理能力、Ability数据存储能力和应用程序需要的环境状态,其中Ability数据存储从API version9开始支持。 -> 说明:本模块首批接口从API version 7开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> **说明:** +> +> 本模块首批接口从API version 7开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## AppStorage @@ -142,7 +144,7 @@ let simple = AppStorage.Get('simpleProp') ### Set -Set(propName: string, newValue: T): boolean +Set\(propName: string, newValue: T): boolean 对已保存的key值,替换其value值。 @@ -165,7 +167,7 @@ let simple = AppStorage.Set('simpleProp', 121); ### SetOrCreate -SetOrCreate(propName: string, newValue: T): void +SetOrCreate\(propName: string, newValue: T): void 创建或更新setOrCreate内部的值。 @@ -646,7 +648,7 @@ PersistentStorage.PersistProps([{'highScore', '0'},{'wightScore','1'}]) ### Keys -Keys(): Array +Keys(): Array\ 返回所有持久化属性的标记。 @@ -654,7 +656,7 @@ Keys(): Array | 类型 | 描述 | | ------------- | -------------------------- | -| Array | 返回所有持久化属性的标记。 | +| Array\ | 返回所有持久化属性的标记。 | ```ts let simple = PersistentStorage.Keys() @@ -728,7 +730,7 @@ Environment.EnvProps([{'accessibilityEnabled', 'default'},{'accessibilityUnEnabl ### Keys -Keys(): Array +Keys(): Array\ 返回关联的系统项。 @@ -736,7 +738,7 @@ Keys(): Array | 类型 | 描述 | | ------------- | ---------------------- | -| Array | 返回关联的系统项数组。 | +| Array\ | 返回关联的系统项数组。 | ```ts let simple = Environment.Keys() diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md index 054824b2f7f471468a57cb0d41f48a1a7d66f439..1f97c15861aa8fb6b9e0627760346dd2a5262e58 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md @@ -59,3 +59,5 @@ struct TransitionExample { } } ``` + +![animateTo](figures/animateTo.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md index 504037c0f918cb24e11f718434d084d363ab064e..021cc278c448273ae8cf0fbec7af7d77cf919152 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md @@ -53,3 +53,4 @@ struct pageBExample { } ``` +![shared](figures/shared.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md index 9f43f0a9139c4489a313bdf3a208dad2d1fee6d2..f1ad36dfd7f9caec182fb07f44812112c588ebe6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md @@ -126,19 +126,19 @@ sendMouseEvent(event: MouseEvent): boolean ```ts // xxx.ets class Utils { - static rect_left; - static rect_top; - static rect_right; - static rect_bottom; - static rect_value; + static rect_left + static rect_top + static rect_right + static rect_bottom + static rect_value //获取组件所占矩形区域坐标 static getComponentRect(key) { - let strJson = getInspectorByKey(key); - let obj = JSON.parse(strJson); - console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let strJson = getInspectorByKey(key) + let obj = JSON.parse(strJson) + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)) let rectInfo = JSON.parse('[' + obj.$rect + ']') - console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + console.info("[getInspectorByKey] rectInfo is: " + rectInfo) this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md index 8dbcd0c5782d3f641edaa1a61049e1bd79c2a41d..176b1d4b04e4ba33d3adca9b8d309f2d3da6c7b8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md @@ -105,4 +105,4 @@ struct FlexExample { } ``` - +![flex](figures/flex.PNG) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md index 3fc5257703195527dba8b5c37e8497b69fd9bb54..09b45008a49582d537d1896e552b0cda0125e538 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md @@ -19,9 +19,9 @@ | saturate | number | 1.0 | 为当前组件添加饱和度效果,饱和度为颜色中的含色成分和消色成分(灰)的比例,入参为1时,显示原图像,大于1时含色成分越大,饱和度越大;小于1时消色成分越大,饱和度越小。(百分比) | | contrast | number | 1.0 | 为当前组件添加对比度效果,入参为对比度的值,值为1时,显示原图;大于1时,值越大对比度越高,图像越清晰醒目;小于1时,值越小对比度越低;当对比度为0时,图像变为全灰。(百分比) | | invert | number | 0 | 反转输入的图像。入参为图像反转的比例。值为1时完全反转。值为0则图像无变化。(百分比) | -| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。 | | sepia | number | 0 | 将图像转换为深褐色。入参为图像反转的比例。值为1则完全是深褐色的,值为0图像无变化。 (百分比) | | hueRotate | number \| string | '0deg' | 色相旋转效果,输入参数为旋转角度。 | +| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md index 832938c1704c97a306e54eb44448efc33227b9e8..86660cec308c85cb96f356972f8b34b69a3eb850 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md @@ -22,7 +22,7 @@ @Entry @Component struct AspectRatioExample { - private children: string[] = ['1', '2', '3', '4', '5', '6']; + private children: string[] = ['1', '2', '3', '4', '5', '6'] build() { Column({ space: 20 }) { diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md index 92463eb228b273e59b141143d599d52b7bbafed5..e95f066470d5881d87ab5b2e32b56b9b25a158a7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md @@ -25,7 +25,9 @@ ## 示例 -#### 普通菜单 +### 示例1 + +普通菜单 ```ts // xxx.ets @@ -58,58 +60,59 @@ struct MenuExample { ![zh-cn_image_0000001174582862](figures/zh-cn_image_0000001174582862.gif) -#### 自定义内容菜单 +### 示例2 -```ts -// xxx.ets -import router from '@system.router'; +自定义内容菜单 +```ts @Entry @Component struct MenuExample { + @State listData: number[] = [0, 0, 0] + @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Text('text1') - .fontSize(20) - .width(100) - .height(50) - .textAlign(TextAlign.Center) - - Divider().height(10) - - Text('text2') - .fontSize(20) - .width(100) - .height(50) - .textAlign(TextAlign.Center) - - Divider().height(10) - - Button('Next') - .fontSize(20) - .width(100) - .height(50) - .onClick(() => { - router.push({ uri: 'pages/details' }) - }) - + ForEach(this.listData, (item, index) => { + Column() { + Row() { + Image($r("app.media.icon")).width(20).height(20).margin({ right: 5 }) + Text(`Menu${index + 1}`).fontSize(20) + } + .width('100%') + .height(30) + .justifyContent(FlexAlign.Center) + .align(Alignment.Center) + .onClick(() => { + console.info(`Menu${index + 1} Clicked!`) + }) + + if (index != this.listData.length - 1) { + Divider().height(10).width('80%').color('#ccc') + } + }.padding(5).height(40) + }) }.width(100) } build() { Column() { Text('click for menu') + .fontSize(20) + .margin({ top: 20 }) + .bindMenu(this.MenuBuilder) } + .height('100%') .width('100%') - .margin({ top: 5 }) - .bindMenu(this.MenuBuilder) + .backgroundColor('#f0f0f0') } } ``` ![zh-cn_image_0000001186807708](figures/zh-cn_image_0000001186807708.gif) -#### 菜单(右键触发显示) +### 示例3 + +菜单(右键触发显示) ```ts // xxx.ets diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index c03775fc9dbeb8e98226a3df3aefd65d7b39d3ae..16070d610f5dd2bbca8bfae08bfd95aa696c71e9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -25,6 +25,8 @@ | primaryButton | {
value: string,
action: () => void
} | 否 | 第一个按钮。
value: 弹窗里主按钮的文本。
action: 点击主按钮的回调函数。 | | secondaryButton | {
value: string,
action: () => void
} | 否 | 第二个按钮。
value: 弹窗里辅助按钮的文本。
action: 点击辅助按钮的回调函数。 | | onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数isVisible为弹窗当前的显示状态。 | +| arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,默认居左;箭头在气泡左右侧时,默认居上。 | +| showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | ## CustomPopupOptions8+类型说明 @@ -39,6 +41,8 @@ | enableArrow | boolean | 否 | 是否显示箭头。
从API Version 9开始,如果箭头所在方位侧的气泡长度不足以显示下箭头,则会默认不显示箭头。比如:placement设置为Left,但气泡高度小于箭头的宽度(32vp),则实际不会显示箭头。
默认值:true | | autoCancel | boolean | 否 | 页面有操作时,是否自动关闭气泡。
默认值:true | | onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数为弹窗当前的显示状态。 | +| arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,默认居左;箭头在气泡左右侧时,默认居上。 | +| showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | ## 示例 @@ -80,7 +84,7 @@ struct PopupExample { secondaryButton: { value: 'cancel', action: () => { - this.handlePopup = !this.handlePopup; + this.handlePopup = !this.handlePopup console.info('cancel Button click') } }, diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md index 31022a190f924f115f28a04a0677333e14d0e823..00fe83401f13a4feded827a272cdba5dad75f4a9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md @@ -53,3 +53,4 @@ struct ClipAndMaskExample { } ``` +![clipAndMask](figures/clipAndMask.PNG) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md index ffa706268f3bd28b93edaa5944ccca29d365c4ca..aa8a4903a08a0394c911ef53a797789add582904 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md @@ -40,7 +40,7 @@ @Entry @Component struct TouchTargetExample { - @State text: string = ""; + @State text: string = "" build() { Column({ space: 20 }) { @@ -49,7 +49,7 @@ struct TouchTargetExample { Button("button1") .responseRegion({ x: 0, y: 0, width: '50%', height: '100%' }) .onClick(() => { - this.text = 'button1 clicked'; + this.text = 'button1 clicked' }) // 热区宽度为按钮的一半,且右移一个按钮宽度,点击button2右侧左边,点击事件生效 @@ -57,14 +57,14 @@ struct TouchTargetExample { Button("button2") .responseRegion({ x: '100%', y: 0, width: '50%', height: '100%' }) .onClick(() => { - this.text = 'button2 clicked'; + this.text = 'button2 clicked' }) // 热区大小为整个按钮,且下移一个按钮高度,点击button3下方按钮大小区域,点击事件生效 Text("{x:0,y:'100%',width:'100%',height:'100%'}") Button("button3") .responseRegion({ x: 0, y: '100%', width: '100%', height: '100%' }) .onClick(() => { - this.text = 'button3 clicked'; + this.text = 'button3 clicked' }) Text(this.text).margin({ top: 50 }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md index e80e0321700b9827646268fb4042630ba7b5ef0b..47ecb3066a940d21d3bab7fab265a8b3e71a4aed 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md @@ -14,21 +14,21 @@ | rotate | {
x?: number,
y?: number,
z?: number,
angle?: Angle,
centerX?: number \| string,
centerY?: number \| string
} | (x, y, z)指定一个矢量,表示旋转轴,正角度为顺时针转动,负角度为逆时针转动,默认值为0,同时可以通过centerX和centerY设置旋转的中心点。
默认值:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
} | | translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可以分别设置X轴、Y轴、Z轴的平移距离,距离的正负控制平移的方向。不支持百分比形式的输入。
默认值:
{
x: 0,
y: 0,
z: 0
}| | scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1,同时可以通过centerX和centerY设置缩放的中心点。
默认值:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
} | -| transform | Matrix4Transit | 设置当前组件的变换矩阵。 | +| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | ## 示例 ```ts // xxx.ets -import Matrix4 from '@ohos.matrix4' +import matrix4 from '@ohos.matrix4' @Entry @Component struct TransformExample { build() { Column() { - Text('rotate').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(30) + Text('rotate').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(14) Row() .rotate({ x: 1, @@ -37,26 +37,29 @@ struct TransformExample { centerX: '50%', centerY: '50%', angle: 300 - }) // 组件以(1,1,1)为旋转轴,中心点顺时针旋转 300度 + }) // 组件以矢量(1,1,1)为旋转轴,绕中心点顺时针旋转300度 .width(100).height(100).backgroundColor(0xAFEEEE) - Text('translate').width('90%').fontColor(0xCCCCCC).padding(10).fontSize(30) + Text('translate').width('90%').fontColor(0xCCCCCC).padding(10).fontSize(14) Row() - .translate({ x: 100, y: 5 }) // x轴平移100,y轴平移5 - .width(100).height(100).backgroundColor(0xAFEEEE).margin({bottom:10}) + .translate({ x: 100, y: 10 }) // x轴方向平移100,y轴方向平移10 + .width(100).height(100).backgroundColor(0xAFEEEE).margin({ bottom: 10 }) - Text('scale').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(30) + Text('scale').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(14) Row() .scale({ x: 2, y: 0.5 }) // 高度缩小一倍,宽度放大一倍,z轴在2D下无效果 .width(100).height(100).backgroundColor(0xAFEEEE) - Text('Matrix4').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(30) + Text('Matrix4').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(14) Row() .width(100).height(100).backgroundColor(0xAFEEEE) - .transform(Matrix4.identity().translate({ x: 100, y: 100, z: 30 })) + .transform(matrix4.identity().translate({ x: 50, y: 50 }).scale({ x: 1.5, y: 1 }).rotate({ + x: 0, + y: 0, + z: 1, + angle: 60 + })) }.width('100%').margin({ top: 5 }) } } ``` - -![zh-cn_image_0000001219864137](figures/zh-cn_image_0000001219864137.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-focus-event.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-focus-event.md index 3f9aa271b4b137b384542758d11a5815086e1c34..8da2d801d8da08ef4d43be199eca9e23301a665a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-focus-event.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-focus-event.md @@ -24,9 +24,9 @@ @Entry @Component struct FocusEventExample { - @State oneButtonColor: string = '#FFC0CB'; - @State twoButtonColor: string = '#87CEFA'; - @State threeButtonColor: string = '#90EE90'; + @State oneButtonColor: string = '#FFC0CB' + @State twoButtonColor: string = '#87CEFA' + @State threeButtonColor: string = '#90EE90' build() { Column({ space: 20 }) { @@ -38,10 +38,10 @@ struct FocusEventExample { .fontColor(Color.Black) .focusable(true) .onFocus(() => { - this.oneButtonColor = '#FF0000'; + this.oneButtonColor = '#FF0000' }) .onBlur(() => { - this.oneButtonColor = '#FFC0CB'; + this.oneButtonColor = '#FFC0CB' }) Button('Second Button') .backgroundColor(this.twoButtonColor) @@ -50,10 +50,10 @@ struct FocusEventExample { .fontColor(Color.Black) .focusable(true) .onFocus(() => { - this.twoButtonColor = '#FF0000'; + this.twoButtonColor = '#FF0000' }) .onBlur(() => { - this.twoButtonColor = '#87CEFA'; + this.twoButtonColor = '#87CEFA' }) Button('Third Button') .backgroundColor(this.threeButtonColor) @@ -62,10 +62,10 @@ struct FocusEventExample { .fontColor(Color.Black) .focusable(true) .onFocus(() => { - this.threeButtonColor = '#FF0000'; + this.threeButtonColor = '#FF0000' }) .onBlur(() => { - this.threeButtonColor = '#90EE90'; + this.threeButtonColor = '#90EE90' }) }.width('100%').margin({ top: 20 }) } diff --git a/zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md b/zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md index 01e19e15adf51882c02d5e484291087bac7c8cbf..49ef0e73a0ec747d6160e18c7885029dbb5f975a 100644 --- a/zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md +++ b/zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md @@ -1,345 +1,375 @@ # DistributedSchedule错误码 -## 201 权限校验失败 - -### 错误信息 -Permission denied. - -### 错误描述 - -当调用流转管理和迁移等接口时,若缺少ohos.permission.MANAGER_MISSIONS或ohos.permission.DISTRIBUTED_DATASYNC,会报此错误码。 - -### 可能原因 -该错误码表示权限校验失败,可能原因是未配置对应权限。 - -### 处理步骤 -配置权限ohos.permission.MANAGER_MISSIONS或ohos.permission.DISTRIBUTED_DATASYNC。 - -## 401 参数检查错误 - -### 错误信息 -The parameter check failed. - -### 错误描述 - -当调用接口提供的入参出现类型、个数、数组大小以及合法性等错误时,会报此错误码。 - -### 可能原因 -该错误码表示入参检查错误,可能原因是callback入参检查错误。 - -### 处理步骤 -检查入参callback是否为合法值。 - ## 16600001 系统服务工作异常 -### 错误信息 -The system ability work abnormally. +**错误信息** + +The system ability works abnormally. -### 错误描述 +**错误描述** 当系统服务工作异常时,会报此错误码。 -### 可能原因 +**可能原因** + 该错误码表示系统服务工作异常,可能原因如下。 1. DMS服务没有正常启动。 2. DMS的binder对象无法正常获取。 3. 流转依赖的其他服务没有正常启动或者binder对象无法获取。 -### 处理步骤 +**处理步骤** + 系统服务内部工作异常,请稍后重试,或者重启设备尝试。 ## 16600002 指定的token或callback未注册 -### 错误描述 +**错误描述** 当调用continuationManager相关的接口时传入的token或callback未提前注册,会报此错误码。 -### 错误信息 -The specified token or callback has not registered. +**错误信息** + +The specified token or callback is not registered. + +**可能原因** -### 可能原因 该错误码可能原因是指定的token或callback未注册。 -### 处理步骤 +**处理步骤** + 请先注册token或callback。 ## 16600003 应用注册token已达到最大次数限制 -### 错误描述 +**错误描述** 当调用continuationManager.registerContinuation接口时次数过多超出限制,会报此错误码。 -### 错误信息 +**错误信息** + The number of token registration times has reached the upper limit. -### 可能原因 +**可能原因** + 该错误码可能原因是应用注册token已达到最大次数限制。 -### 处理步骤 +**处理步骤** + 请勿频繁注册,请使用已注册的token。 ## 16600004 指定的callback已注册 -### 错误描述 +**错误描述** 当使用相同的callback调用continuationManager的on接口时,会报此错误码。 -### 错误信息 +**错误信息** + The specified callback has been registered. -### 可能原因 +**可能原因** + 该错误码表示指定的callback已注册,可能原因是使用相同的callback重复注册。 -### 处理步骤 +**处理步骤** + 请勿使用相同的callback重复注册。 ## 16300501 系统服务工作异常 -### 错误描述 +**错误描述** 当系统服务工作异常时,会报此错误码。 -### 错误信息 -The system ability work abnormally. +**错误信息** + +The system ability works abnormally. + +**可能原因** -### 可能原因 该错误码表示系统服务工作异常,可能原因如下。 1. DMS服务没有正常启动。 2. DMS的binder对象无法正常获取。 3. 流转依赖的其他服务没有正常启动或者binder对象无法获取。 -### 处理步骤 +**处理步骤** + 系统服务内部工作异常,请稍后重试,或者重启设备尝试。 ## 16300502 获取指定的missionId的missionInfo失败 -### 错误描述 +**错误描述** 当调用distributedMissionManager.continueMission接口获取指定missionId的missionInfo失败时,会报此错误码。 -### 错误信息 +**错误信息** + Failed to get the missionInfo of the specified missionId. -### 可能原因 +**可能原因** + 该错误码表示获取指定的missionId的missionInfo失败,可能原因如下。 1. missionId输入错误。 2. missionId对应的missionInfo确实不存在。 -### 处理步骤 +**处理步骤** + 请检查输入的missionId是否正确。 ## 16300503 远端未安装应用且不支持免安装 -### 错误描述 +**错误描述** 当调用distributedMissionManager.continueMission接口使用迁移功能时,若远端未安装应用且不支持免安装,会报此错误码。 -### 错误信息 +**错误信息** + The application is not installed on the remote end and installation-free is not supported. -### 可能原因 +**可能原因** + 该错误码可能原因是远端未安装迁移应用并且不支持免安装。 -### 处理步骤 +**处理步骤** + 1. 请检查远端是否已安装需要迁移的应用。 2. 请检查远端是否支持免安装。 ## 16300504 远端未安装应用但支持免安装,需使用免安装标识重试 -### 错误描述 +**错误描述** 当调用distributedMissionManager.continueMission接口使用迁移功能时,若远端未安装应用但支持免安装,会报此错误码。 -### 错误信息 -The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. +**错误信息** + +The application is not installed on the remote end and installation-free is supported. Try again with the freeInstall flag. + +**可能原因** -### 可能原因 该错误码可能原因是远端未安装应用但支持免安装,使用时未使用免安装的标识。 -### 处理步骤 +**处理步骤** + 请使用免安装的标识重试。 ## 16300505 操作设备必须是迁移的应用所在的设备或需迁移到的目标设备 -### 错误描述 +**错误描述** 当调用distributedMissionManager.continueMission接口使用迁移功能时,若操作设备不是迁移的应用所在的设备或需迁移到的目标设备,会报此错误码。 -### 错误信息 -The operation device must be the device where the application to be continued is located or the target device to be continued. +**错误信息** + +The operation device must be the device where the application to be continued is currently located or the target device. + +**可能原因** -### 可能原因 该错误码可能原因是操作设备不是迁移的应用所在的设备或需迁移到的目标设备。 -### 处理步骤 +**处理步骤** + 请检查操作设备是否是迁移的应用所在的设备或需迁移到的目标设备。 ## 16300506 本地迁移任务已在进行中 -### 错误描述 +**错误描述** 当调用distributedMissionManager.continueMission接口使用迁移功能时,若本地迁移任务已在进行中,会报此错误码。 -### 错误信息 +**错误信息** + The local continuation task is already in progress. -### 可能原因 +**可能原因** + 该错误码表示本地迁移任务已在进行中,可能原因是已经发起了迁移任务还未结束。 -### 处理步骤 +**处理步骤** + 请检查是否已经发起了迁移并未结束。 ## 3 序列化对象失败 -### 错误描述 +**错误描述** 当调用continuationManager相关接口时,若系统参数DMS_PROXY_INTERFACE_TOKEN序列化写失败,会报此错误码。 -### 错误信息 +**错误信息** + Failed to flatten the object. -### 可能原因 +**可能原因** + 该错误码表示对象序列化过程中出现错误,可能原因是系统参数DMS_PROXY_INTERFACE_TOKEN序列化写失败。 -### 处理步骤 +**处理步骤** + 请检查系统功能是否正常或者重启。 ## 7 空对象 -### 错误信息 +**错误信息** + The object is null. -### 错误描述 +**错误描述** 当调用流转和迁移相关接口时,若出现dms以及其他对象为空或序列化读失败,会报此错误码。 -### 可能原因 +**可能原因** + 该错误码表示接口依赖的服务对象或参数对象为空,可能原因如下。 1. 入参序列化读失败。 2. DMS服务没有正常启动或binder对象无法正常获取。 3. DMS依赖的其他服务没有正常启动或者binder对象无法获取。 -### 处理步骤 +**处理步骤** + 1. 检查入参是否为有效合法值。 2. 检查DMS服务是否正常启动,重新启动服务或重启设备。 3. 检查DMS依赖的其他服务是否正常启动,重新启动服务或重启设备。 ## 29360207 注册超出最大次数 -### 错误描述 +**错误描述** 当调用continuationManager.register接口时次数过多超出限制,会报此错误码。 -### 错误信息 -The maximum number of registrations exceeded. +**错误信息** + +The number of registrations has reached the upper limit. + +**可能原因** -### 可能原因 该错误码可能原因是设备频繁注册,次数超出最大次数限制。 -### 处理步骤 +**处理步骤** + 重启服务并且避免频繁注册。 ## 29360208 token未注册 -### 错误描述 +**错误描述** 当调用continuationManager相关接口时使用未注册的token,会报此错误码。 -### 错误信息 -The token has not registered. +**错误信息** + +The token is not registered. + +**可能原因** -### 可能原因 该错误码可能原因是未注册token。 -### 处理步骤 +**处理步骤** + 注册token并使用已注册的token。 ## 29360209 callback已注册 -### 错误描述 +**错误描述** 当使用相同的callback重复调用continuationManager.on接口时,会报此错误码。 -### 错误信息 -Callback has been registered. +**错误信息** + +The callback has been registered. + +**可能原因** -### 可能原因 该错误码能原因是指定的callback已经注册过。 -### 处理步骤 +**处理步骤** + 请勿使用相同的callback重复注册。 ## 29360210 callback未注册 -### 错误描述 +**错误描述** 当调用continuationManager的off、updateConnectStatus和startDeviceManager等接口时,若未提前调用on接口注册callback,会报此错误码。 -### 错误信息 -Callback has not been registered. +**错误信息** + +The callback is not registered. + +**可能原因** -### 可能原因 该错误码可能原因是指定的callback未注册。 -### 处理步骤 +**处理步骤** + 注册callback并使用已注册的callback。 ## 29360211 连接ability失败 -### 错误描述 +**错误描述** 当调用continuationManager的startDeviceManager接口时,若连接相应Ability失败时,会报此错误码。 -### 错误信息 -Failed to connect ability. +**错误信息** + +Failed to connect to the ability. + +**可能原因** -### 可能原因 该错误码可能原因是指定token连接ability失败。 -### 处理步骤 +**处理步骤** + 检查token是否有效以及相应ability是否正常服务,重新启动服务或重启设备。 ## 29360214 callback类型错误 -### 错误描述 +**错误描述** 当调用continuationManager的on和off接口时,若参数callback类型错误时,会报此错误码。 -### 错误信息 +**错误信息** + The type of callback is not supported. -### 可能原因 +**可能原因** + 该错误码表示callback类型错误,可能原因是不支持传入的callback类型。 -### 处理步骤 +**处理步骤** + 请使用系统支持的callback类型并传入。 ## 29360215 无效的连接状态 -### 错误描述 +**错误描述** 当调用continuationManager的updateConnectStatus接口时,若参数status为无效值时,会报此错误码。 -### 错误信息 -Invalid connect state. +**错误信息** + +Invalid connection state. + +**可能原因** -### 可能原因 该错误码表示无效的连接状态,可能原因是入参DeviceConnectState为非指定值。 -### 处理步骤 +**处理步骤** + 设置指定合法的DeviceConnectState值。 ## 29360216 无效的流转模式 -### 错误描述 +**错误信息** + +Invalid continuation mode. + +**错误描述** 当调用continuationManager的register和startDeviceManager接口时,若参数ContinuationExtraParams.continuationMode为无效值时,会报此错误码。 -### 错误信息 -Invalid continuation mode. +**可能原因** -### 可能原因 该错误码可能原因是入参ContinuationExtraParams.continuationMode为非指定值。 -### 处理步骤 +**处理步骤** + 设置指定合法的ContinuationExtraParams.continuationMode值。 diff --git a/zh-cn/application-dev/security/cryptoFramework-guidelines.md b/zh-cn/application-dev/security/cryptoFramework-guidelines.md index 734dcf92c03846e7755e29005c5fd9914d5a3195..a282c7b7c6113719ca57af818846887e20ce5f19 100644 --- a/zh-cn/application-dev/security/cryptoFramework-guidelines.md +++ b/zh-cn/application-dev/security/cryptoFramework-guidelines.md @@ -100,21 +100,17 @@ function testGenerateAesKey() { 示例3:根据指定的RSA非对称密钥二进制数据,生成KeyPair对象(场景2) -1. 获取RSA二进制密钥数据封装成DataBlob对象,按keysize(32位的密钥位数) 、nsize(32位,值为keysize/8)、 esize(32位的大数e的实际长度,单位Byte)、dsize(32位,值位keysize/8)、nval(大数n的二进制数据)、eval(大数e的二进制数据)和dval(大数d的二进制数据)拼接形成。 -2. 调用convertKey方法,传入公钥二进制和私钥二进制(二者非必选项,可只传入其中一个),转换为KeyPair对象。 +1. 获取RSA公钥或私钥二进制数据,公钥需满足ASN.1语法、X.509规范、DER编码格式,私钥需满足ASN.1语法、PKCS#8规范、DER编码格式。 +2. 创建AsyKeyGenerator对象,调用convertKey方法,传入公钥二进制和私钥二进制(二者非必选项,可只传入其中一个),转换为KeyPair对象。 ```javascript import cryptoFramework from '@ohos.security.cryptoFramework'; function convertAsyKey() { - let rsaGenerator = cryptoFramework.createAsyKeyGenerator("RSA1024"); - // 公钥二进制数据 - let pkval = new Uint8Array([0,4,0,0,128,0,0,0,3,0,0,0,0,0,0,0,182,22,137,81,111,129,17,47,33,97,67,85,251,53,127,42,130,150,93,144,129,104,14,73,110,189,138,82,53,74,114,86,24,186,143,65,87,110,237,69,206,207,5,81,24,32,41,160,209,125,162,92,0,148,49,241,235,0,71,198,1,28,136,106,152,22,25,249,77,241,57,149,154,44,200,6,0,83,246,63,162,106,242,131,80,227,143,162,210,28,127,136,123,172,26,247,2,194,16,1,100,122,180,251,57,22,69,133,232,145,107,66,80,201,151,46,114,175,116,57,45,170,188,77,86,230,111,45,1,0,1]); - // 封装成DataBlob对象 + let rsaGenerator = cfm.createAsyKeyGenerator("RSA1024"); + let pkval = new Uint8Array([48,129,159,48,13,6,9,42,134,72,134,247,13,1,1,1,5,0,3,129,141,0,48,129,137,2,129,129,0,174,203,113,83,113,3,143,213,194,79,91,9,51,142,87,45,97,65,136,24,166,35,5,179,42,47,212,79,111,74,134,120,73,67,21,19,235,80,46,152,209,133,232,87,192,140,18,206,27,106,106,169,106,46,135,111,118,32,129,27,89,255,183,116,247,38,12,7,238,77,151,167,6,102,153,126,66,28,253,253,216,64,20,138,117,72,15,216,178,37,208,179,63,204,39,94,244,170,48,190,21,11,73,169,156,104,193,3,17,100,28,60,50,92,235,218,57,73,119,19,101,164,192,161,197,106,105,73,2,3,1,0,1]); let pkBlob = {data : pkval}; - // 调用密钥转换函数 - let convertKeyPromise = rsaGenerator.convertKey(pkBlob, null); - convertKeyPromise.then( keyPair => { + rsaGenerator.convertKey(pkBlob, null, function(err, keyPair) { if (keyPair == null) { AlertDialog.show({message : "Convert keypair fail"}); } @@ -125,10 +121,7 @@ function convertAsyKey() { **说明** -1. nsize和dsize为密钥位数/8,esize为具体的实际长度。 -2. 私钥材料需要包含keysize,nsize,esize,dsize,nval,eval,dval的全部数据,公钥材料中dsize设置为为0,缺省dval的数据。 -3. 公钥和私钥二进制数据为可选项,可单独传入公钥或私钥的数据,生成对应只包含公钥或私钥的KeyPair对象。 -4. keysize、nsize、esize和dsize为32位二进制数据,数据的大小端格式请按设备CPU默认格式,密钥材料(nval、eval、dval)统一为大端格式。 + 当前convertKey操作,公钥只支持转换满足X.509规范的DER格式,私钥只支持PKCS#8规范的DER格式; 示例4:根据指定的ECC非对称密钥二进制数据,生成KeyPair对象(场景2、3) @@ -545,6 +538,12 @@ function encryptMessageCallback() { } ``` +**说明** + +1. 使用RSA加解密时,Cipher对象不可重复调用init方法初始化,在创建了一个加密Cipher对象后,如果要进行解密,则需要重新创建另一个Cipher对象执行解密操作。 +2. RSA加密有长度限制,允许加密明文的最大长度见[加解密算法库框架概述](cryptoFramework-overview.md)中的基本概念章节。 +3. RSA解密每次允许解密的密文长度为,RSA密钥的位数/8。 + ## 使用签名验签操作 **场景说明** diff --git a/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md b/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md index eff04082dae1a611a07b61a2abadd589d061f604..2bd9d277227ef129572b18b0def810169c77b548 100644 --- a/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md +++ b/zh-cn/device-dev/reference/hdi-apis/Readme-CN.md @@ -107,7 +107,7 @@ - [AudioDeviceDescriptor](_audio_device_descriptor.md) - [AudioManager](_audio_manager.md) - [AudioMixExtInfo](_audio_mix_ext_info.md) - - [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) + - [AudioMmapBufferDescriptor](_audio_mmap_buffer_descriptor.md) - [AudioPort](_audio_port.md) - [AudioPortCap](audio_portcap.md) - [AudioPortCapability](_audio_port_capability.md) diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio.md b/zh-cn/device-dev/reference/hdi-apis/_audio.md index 722ca8820dcac1d8a751e0c3ef62b966607e7f5e..9dde93d0d7f47911dc97740ccf20f51b7a7ad570 100644 --- a/zh-cn/device-dev/reference/hdi-apis/_audio.md +++ b/zh-cn/device-dev/reference/hdi-apis/_audio.md @@ -54,7 +54,7 @@ Audio模块接口定义。 | [AudioTimeStamp](_audio_time_stamp.md) | 音频时间戳 | | [AudioSubPortCapability](_audio_sub_port_capability.md) | 音频子端口的支持能力 | | [AudioPortCapability](_audio_port_capability.md) | 音频端口的支持能力 | -| [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) | mmap缓冲区描述符 | +| [AudioMmapBufferDescriptor](_audio_mmap_buffer_descriptor.md) | mmap缓冲区描述符 | | [AudioDevExtInfo](_audio_dev_ext_info.md) | 音频设备拓展信息 | | [AudioMixExtInfo](_audio_mix_ext_info.md) | 音轨拓展信息 | | [AudioSessionExtInfo](_audio_session_ext_info.md) | 会话拓展信息 | @@ -145,11 +145,11 @@ Audio模块接口定义。 | [AudioPortCapability::subPorts](#subports) | 支持的子端口列表。 | | [AudioPortCapability::supportSampleFormatNum](#supportsampleformatnum) | 支持的音频样本格式数量。 | | [AudioPortCapability::supportSampleFormats](#supportsampleformats) | 支持的音频样本格式。 | -| [AudioMmapBufferDescripter::memoryAddress](#memoryaddress) | 指向mmap缓冲区的指针。 | -| [AudioMmapBufferDescripter::memoryFd](#memoryfd) | mmap缓冲区的文件描述符。 | -| [AudioMmapBufferDescripter::totalBufferFrames](#totalbufferframes) | 缓冲区总大小,单位:帧。 | -| [AudioMmapBufferDescripter::transferFrameSize](#transferframesize) | 传输大小,单位:帧。 | -| [AudioMmapBufferDescripter::isShareable](#isshareable) | mmap缓冲区是否可以在进程间共享。 | +| [AudioMmapBufferDescriptor::memoryAddress](#memoryaddress) | 指向mmap缓冲区的指针。 | +| [AudioMmapBufferDescriptor::memoryFd](#memoryfd) | mmap缓冲区的文件描述符。 | +| [AudioMmapBufferDescriptor::totalBufferFrames](#totalbufferframes) | 缓冲区总大小,单位:帧。 | +| [AudioMmapBufferDescriptor::transferFrameSize](#transferframesize) | 传输大小,单位:帧。 | +| [AudioMmapBufferDescriptor::isShareable](#isshareable) | mmap缓冲区是否可以在进程间共享。 | | [AudioDevExtInfo::moduleId](#moduleid-12) | 音频流绑定的模块ID。 | | [AudioDevExtInfo::type](#type-23) | 音频端口上的PIN脚(输出、输入)。 | | [AudioDevExtInfo::desc](#desc-55) | 地址描述。 | @@ -797,7 +797,7 @@ bool AudioSampleAttributes::isBigEndian ``` -int32_t AudioMmapBufferDescripter::isShareable +int32_t AudioMmapBufferDescriptor::isShareable ``` **描述:** @@ -833,7 +833,7 @@ enum AudioPortPassthroughMode AudioSubPortCapability::mask ``` -void* AudioMmapBufferDescripter::memoryAddress +void* AudioMmapBufferDescriptor::memoryAddress ``` **描述:** @@ -845,7 +845,7 @@ void* AudioMmapBufferDescripter::memoryAddress ``` -int32_t AudioMmapBufferDescripter::memoryFd +int32_t AudioMmapBufferDescriptor::memoryFd ``` **描述:** @@ -1229,7 +1229,7 @@ enum AudioSampleFormat* AudioPortCapability::supportSampleFormats ``` -int32_t AudioMmapBufferDescripter::totalBufferFrames +int32_t AudioMmapBufferDescriptor::totalBufferFrames ``` **描述:** @@ -1241,7 +1241,7 @@ int32_t AudioMmapBufferDescripter::totalBufferFrames ``` -int32_t AudioMmapBufferDescripter::transferFrameSize +int32_t AudioMmapBufferDescriptor::transferFrameSize ``` **描述:** diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md b/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md index 32fb2917b206ae9297f47d920e61a9c1cac27323..2281b389b21c0a4c1111e9b1d12490fc9c3070fb 100644 --- a/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_attribute.md @@ -34,7 +34,7 @@ AudioAttribute音频属性接口。 | ([GetCurrentChannelId](#getcurrentchannelid))(AudioHandle handle, uint32_t \*channelId) | 获取音频的数据通道ID | | ([SetExtraParams](#setextraparams))(AudioHandle handle, const char \*keyValueList) | 设置音频拓展参数 | | ([GetExtraParams](#getextraparams))(AudioHandle handle, char \*keyValueList) | 获取音频拓展参数 | -| ([ReqMmapBuffer](#reqmmapbuffer))(AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescripter \*desc) | 请求Mmap缓冲区 | +| ([ReqMmapBuffer](#reqmmapbuffer))(AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescriptor \*desc) | 请求Mmap缓冲区 | | ([GetMmapPosition](#getmmapposition))(AudioHandle handle, uint64_t \*frames, struct AudioTimeStamp \*time) | 获取当前Mmap的读/写位置 | | ([AddAudioEffect](#addaudioeffect))(AudioHandle handle, uint64_t effectid) | 添加音频效果算法实例 | | ([RemoveAudioEffect](#removeaudioeffect))(AudioHandle handle, uint64_t effectid) | 移除音频效果算法实例 | @@ -260,7 +260,7 @@ int32_t (*AudioAttribute::RemoveAudioEffect)(AudioHandle handle, uint64_t effect ``` -int32_t(* AudioAttribute::ReqMmapBuffer) (AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescripter *desc) +int32_t(* AudioAttribute::ReqMmapBuffer) (AudioHandle handle, int32_t reqSize, struct AudioMmapBufferDescriptor *desc) ``` **描述:** diff --git a/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descripter.md b/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descriptor.md similarity index 95% rename from zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descripter.md rename to zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descriptor.md index 93470c6b005a438663e7efd1b8e6ec204701af20..8488a838eff0aaec2b8f565f494ee0f07e88fcbb 100644 --- a/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descripter.md +++ b/zh-cn/device-dev/reference/hdi-apis/_audio_mmap_buffer_descriptor.md @@ -1,4 +1,4 @@ -# AudioMmapBufferDescripter +# AudioMmapBufferDescriptor ## **概述** diff --git a/zh-cn/device-dev/reference/hdi-apis/annotated.md b/zh-cn/device-dev/reference/hdi-apis/annotated.md index 1b11935d7048c296973c1cfb3958f85c7a849c9e..e415acf8378b78b8e569253222748e5404e3f36b 100644 --- a/zh-cn/device-dev/reference/hdi-apis/annotated.md +++ b/zh-cn/device-dev/reference/hdi-apis/annotated.md @@ -30,7 +30,7 @@ - **[AudioMixExtInfo](_audio_mix_ext_info.md)** -- **[AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md)** +- **[AudioMmapBufferDescriptor](_audio_mmap_buffer_descriptor.md)** - **[AudioPort](_audio_port.md)** diff --git a/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md b/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md index 48baaa842760e3dbae132136694f78d1359052ef..2d61f62b539d810e3c92d314d6c40a19912f47f5 100644 --- a/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md +++ b/zh-cn/device-dev/reference/hdi-apis/audio__types_8h.md @@ -34,7 +34,7 @@ Audio模块接口定义中使用的自定义数据类型,包括音频端口、 | [AudioTimeStamp](_audio_time_stamp.md) | 音频时间戳 | | [AudioSubPortCapability](_audio_sub_port_capability.md) | 音频子端口的支持能力 | | [AudioPortCapability](_audio_port_capability.md) | 音频端口的支持能力 | -| [AudioMmapBufferDescripter](_audio_mmap_buffer_descripter.md) | mmap缓冲区描述符 | +| [AudioMmapBufferDescriptor](_audio_mmap_buffer_descriptor.md) | mmap缓冲区描述符 | | [AudioDevExtInfo](_audio_dev_ext_info.md) | 音频设备拓展信息. | | [AudioMixExtInfo](_audio_mix_ext_info.md) | 音轨拓展信息 | | [AudioSessionExtInfo](_audio_session_ext_info.md) | 会话拓展信息 | diff --git a/zh-cn/device-dev/website.md b/zh-cn/device-dev/website.md index 0ece4c28eb5f077f564cae8a07c60d40b5fd68e7..181e52c7768c353051b8e2780a125d79a4dd9128 100644 --- a/zh-cn/device-dev/website.md +++ b/zh-cn/device-dev/website.md @@ -647,7 +647,7 @@ - [AudioDeviceDescriptor](reference/hdi-apis/_audio_device_descriptor.md) - [AudioManager](reference/hdi-apis/_audio_manager.md) - [AudioMixExtInfo](reference/hdi-apis/_audio_mix_ext_info.md) - - [AudioMmapBufferDescripter](reference/hdi-apis/_audio_mmap_buffer_descripter.md) + - [AudioMmapBufferDescriptor](reference/hdi-apis/_audio_mmap_buffer_descriptor.md) - [AudioPort](reference/hdi-apis/_audio_port.md) - [AudioPortCap](reference/hdi-apis/audio_portcap.md) - [AudioPortCapability](reference/hdi-apis/_audio_port_capability.md)