提交 73a1ce58 编写于 作者: 葛亚芳 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: N葛亚芳 <geyafang@huawei.com>
......@@ -231,7 +231,7 @@ zh-cn/application-dev/reference/apis/js-apis-audio.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-camera.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-image.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-media.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-i18n.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-intl.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @HelloCrease
......@@ -365,4 +365,7 @@ zh-cn/application-dev/reference/apis/js-apis-buffer.md @zengyawen
zh-cn/application-dev/reference/js-service-widget-ui @HelloCrease
zh-cn/application-dev/website.md @zengyawen
zh-cn/application-dev/faqs/ @zengyawen
zh-cn/application-dev/reference/apis/js-apis-useriam-faceauth.md @zengyawen
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-useriam-faceauth.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-userfilemanager.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @zengyawen
zh-cn/application-dev/reference/apis/Readme-CN.md @zengyawen
\ No newline at end of file
......@@ -12,4 +12,4 @@
- [三四方库使用常见问题](faqs-third-party-library.md)
- [IDE使用常见问题](faqs-ide.md)
- [hdc_std命令使用常见问题](faqs-hdc-std.md)
- [开发板](faqs-development-board.md)
- [开发板使用常见问题](faqs-development-board.md)
......@@ -789,7 +789,7 @@ definePermission仅支持系统应用配置,三方应用配置不生效。
| 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| ----------------------- | ------------------------------------------------------------ | -------- | ---------- |
| name | 标识权限的名称 | 字符串 | 不可缺省 |
| grantMode | 标识权限的授予方式,该标签可缺省,缺省值为system_grant。<br />授予模式如下:<br />system_grant:安装后系统自动授予该权限。<br />user_grant:使用时动态申请,用户授权后才可使用。 | 字符串 | 可缺省 |
| grantMode | 标识权限的授予方式,该标签可缺省,缺省值为system_grant。<br />授予模式如下:<br />system_grant:安装后系统自动授予该权限。<br />user_grant:使用时动态申请,用户授权后才可使用。 | 字符串 | 可缺省 |
| availableLevel | 标识权限限制门限。可选值为"system_code","system_basic","normal",该标签有缺省值,缺省值为normal。权限范围如下:<br />system_core:系统核心权限。<br />system_basic:系统基础权限。<br />normal:普通权限。所有应用允许申请的权限 | 字符串 | 可缺省 |
| provisionEnable | 标识权限是否支持证书方式申请权限,包括高级别的权限,该标签有缺省值,缺省值为true。配置为true标识需要开发者可以通过provision方式申请权限。 | 布尔值 | 可缺省 |
| distributedSceneEnabled | 标识权限是否支持分布式场景下使用该权限,该标签有缺省值,缺省值为false。 | 布尔值 | 可缺省 |
......
# 接口
# 接口
- [开发说明](development-intro.md)
- Ability框架
- FA模型
- [@ohos.ability.featureAbility (FeatureAbility模块)](js-apis-featureAbility.md)
- [@ohos.ability.particleAbility (particleAbility模块)](js-apis-particleAbility.md)
......@@ -28,8 +25,6 @@
- application/[FormExtensionContext (FormExtensionContext)](js-apis-formextensioncontext.md)
- application/[PermissionRequestResult (PermissionRequestResult)](js-apis-permissionrequestresult.md)
- application/[ServiceExtensionContext (ServiceExtensionContext)](js-apis-service-extension-context.md)
- [InputMethodExtensionAbility (InputMethodExtensionAbility)](js-apis-inputmethod-extension-ability.md)
- [InputMethodExtensionContext (InputMethodExtensionContext)](js-apis-inputmethod-extension-context.md)
- 通用
- [@ohos.ability.dataUriUtils (DataUriUtils模块)](js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode (ErrorCode)](js-apis-ability-errorCode.md)
......@@ -65,14 +60,12 @@
- application/[shellCmdResult (ShellCmdResult)](js-apis-application-shellCmdResult.md)
- continuation/[ContinuationResult (ContinuationResult)](js-apis-continuation-continuationResult.md)
- 公共事件与通知
- [@ohos.commonEvent (公共事件模块)](js-apis-commonEvent.md)
- [@ohos.events.emitter (Emitter)](js-apis-emitter.md)
- [@ohos.notification (Notification模块)](js-apis-notification.md)
- [@ohos.reminderAgent (后台代理提醒)](js-apis-reminderAgent.md)
- application/[EventHub (EventHub)](js-apis-eventhub.md)
- 应用程序包管理
- [@ohos.bundle (Bundle模块)](js-apis-Bundle.md)
- [@ohos.bundle.defaultAppManager (Bundle模块)](js-apis-bundle-defaultAppManager.md)
- [@ohos.bundle.innerBundleManager (innerBundleManager模块(JS端SDK接口))](js-apis-Bundle-InnerBundleManager.md)
......@@ -97,14 +90,12 @@
- bundle/[ShortcutInfo (ShortcutInfo)](js-apis-bundle-ShortcutInfo.md)
- bundle/[PackInfo (PackInfo)](js-apis-bundle-PackInfo.md)
- UI界面
- [@ohos.animator (动画)](js-apis-animator.md)
- [@ohos.mediaquery (媒体查询)](js-apis-mediaquery.md)
- [@ohos.prompt (弹窗)](js-apis-prompt.md)
- [@ohos.router (页面路由)](js-apis-router.md)
- [@ohos.uiAppearance(用户界面外观)](js-apis-uiappearance.md)
- 图形图像
- [@ohos.animation.windowAnimationManager (窗口动画管理)](js-apis-windowAnimationManager.md)
- [@ohos.display (屏幕属性)](js-apis-display.md)
- [@ohos.effectKit (图像效果)](js-apis-effectKit.md)
......@@ -115,38 +106,32 @@
- [webgl (WebGL)](js-apis-webgl.md)
- [webgl2 (WebGL2)](js-apis-webgl2.md)
- 媒体
- [@ohos.multimedia.audio (音频管理)](js-apis-audio.md)
- [@ohos.multimedia.camera (相机管理)](js-apis-camera.md)
- [@ohos.multimedia.image (图片处理)](js-apis-image.md)
- [@ohos.multimedia.media (媒体服务)](js-apis-media.md)
- [@ohos.multimedia.medialibrary (媒体库管理)](js-apis-medialibrary.md)
- 资源管理
- [@ohos.i18n (国际化-I18n)](js-apis-i18n.md)
- [@ohos.intl (国际化-Intl)](js-apis-intl.md)
- [@ohos.resourceManager (资源管理)](js-apis-resource-manager.md)
- 资源调度
- [@ohos.backgroundTaskManager (后台任务管理)](js-apis-backgroundTaskManager.md)
- [@ohos.distributedMissionManager (分布式任务管理)](js-apis-distributedMissionManager.md)
- [@ohos.workScheduler (延迟任务调度)](js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理
- [@ohos.configPolicy (配置策略)](js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager (企业设备管理)](js-apis-enterprise-device-manager.md)
- [@ohos.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterpriseDeviceManager (企业设备管理)](js-apis-enterprise-device-manager.md)
- enterpriseDeviceManager/[DeviceSettingsManager(设备设置管理)](js-apis-enterpriseDeviceManager-DeviceSettingsManager.md)
- 安全
- [@ohos.abilityAccessCtrl (访问控制管理)](js-apis-abilityAccessCtrl.md)
- [@ohos.privacyManager (隐私管理)](js-apis-privacyManager.md)
- [@ohos.security.huks (通用密钥库系统)](js-apis-huks.md)
- [@ohos.userIAM.userAuth (用户认证)](js-apis-useriam-userauth.md)
- [@ohos.userIAM.faceAuth (人脸认证)](js-apis-useriam-faceauth.md)
- [@ohos.userIAM.userAuth (用户认证)](js-apis-useriam-userauth.md)
- [@system.cipher (加密算法)](js-apis-system-cipher.md)
- 数据管理
- [@ohos.data.dataAbility (DataAbility谓词)](js-apis-data-ability.md)
- [@ohos.data.dataShare (数据共享)](js-apis-data-dataShare.md)
- [@ohos.data.dataSharePredicates (数据共享谓词)](js-apis-data-dataSharePredicates.md)
......@@ -158,49 +143,47 @@
- [@ohos.data.ValuesBucket (数据集)](js-apis-data-ValuesBucket.md)
- data/rdb/[resultSet (结果集)](js-apis-data-resultset.md)
- 文件管理
- [@ohos.document (文件交互)](js-apis-document.md)
- [@ohos.environment (目录环境能力)](js-apis-environment.md)
- [@ohos.fileio (文件管理)](js-apis-fileio.md)
- [@ohos.fileManager (公共文件访问与管理)](js-apis-filemanager.md)
- [@ohos.filemanagement.userfile_manager (用户数据管理)](js-apis-userfilemanager.md)
- [@ohos.multimedia.medialibrary (媒体库管理)](js-apis-medialibrary.md)
- [@ohos.securityLabel (数据标签)](js-apis-securityLabel.md)
- [@ohos.statfs (statfs)](js-apis-statfs.md)
- [@ohos.storageStatistics (应用空间统计)](js-apis-storage-statistics.md)
- [@ohos.volumeManager (卷管理)](js-apis-volumemanager.md)
- [@ohos.securityLabel (数据标签)](js-apis-securityLabel.md)
- 电话服务
- [@ohos.contact (联系人)](js-apis-contact.md)
- [@ohos.telephony.call (拨打电话)](js-apis-call.md)
- [@ohos.telephony.data (蜂窝数据)](js-apis-telephony-data.md)
- [@ohos.telephony.observer (observer)](js-apis-observer.md)
- [@ohos.telephony.radio (网络搜索)](js-apis-radio.md)
- [@ohos.telephony.sim (SIM卡管理)](js-apis-sim.md)
- [@ohos.telephony.sms (短信服务)](js-apis-sms.md)
- [@ohos.telephony.data (蜂窝数据)](js-apis-telephony-data.md)
- 网络管理
- [@ohos.net.connection (网络连接管理)](js-apis-net-connection.md)
- [@ohos.net.statistics (网络流量管理)](js-apis-net-statistics.md)
- [@ohos.net.policy (网络策略管理)](js-apis-net-policy.md)
- [@ohos.net.ethernet (以太网连接管理)](js-apis-net-ethernet.md)
- [@ohos.net.sharing (网络共享管理)](js-apis-net-sharing.md)
- [@ohos.net.http (数据请求)](js-apis-http.md)
- [@ohos.request (上传下载)](js-apis-request.md)
- [@ohos.net.policy (网络策略管理)](js-apis-net-policy.md)
- [@ohos.net.sharing (网络共享管理)](js-apis-net-sharing.md)
- [@ohos.net.socket (Socket连接)](js-apis-socket.md)
- [@ohos.net.webSocket (WebSocket连接)](js-apis-webSocket.md)
- [@ohos.net.statistics (网络流量管理)](js-apis-net-statistics.md)
- [@ohos.net.tlsSocket (TLSSocket连接)](js-apis-tlsSocket.md)
- [@ohos.net.webSocket (WebSocket连接)](js-apis-webSocket.md)
- [@ohos.request (上传下载)](js-apis-request.md)
- 通信与连接
- [@ohos.bluetooth (蓝牙)](js-apis-bluetooth.md)
- [@ohos.connectedTag (有源标签)](js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (标准NFC-cardEmulation)](js-apis-cardEmulation.md)
- [@ohos.nfc.controller (标准NFC)](js-apis-nfcController.md)
- [@ohos.nfc.tag (标准NFC-Tag)](js-apis-nfcTag.md)
- [@ohos.nfc.tag (标准NFC-Tag Nfc 技术)](js-apis-nfctech.md)
- [@ohos.nfc.tag (标准NFC-Tag TagSession)](js-apis-tagSession.md)
- [@ohos.rpc (RPC通信)](js-apis-rpc.md)
- [@ohos.wifi (WLAN)](js-apis-wifi.md)
- [@ohos.wifiext (WLAN)](js-apis-wifiext.md)
- tag/[nfctech (标准NFC-Tag Nfc 技术)](js-apis-nfctech.md)
- tag/[tagSession (标准NFC-Tag TagSession)](js-apis-tagSession.md)
- 系统基础能力
- [@ohos.accessibility (辅助功能)](js-apis-accessibility.md)
- [@ohos.accessibility.config (系统辅助功能配置)](js-apis-accessibility-config.md)
- [@ohos.faultLogger (故障日志获取)](js-apis-faultLogger.md)
......@@ -211,8 +194,10 @@
- [@ohos.hiSysEvent (系统事件打点)](js-apis-hisysevent.md)
- [@ohos.hiTraceChain (分布式跟踪)](js-apis-hitracechain.md)
- [@ohos.hiTraceMeter (性能打点)](js-apis-hitracemeter.md)
- [@ohos.inputMethod (输入法框架)](js-apis-inputmethod.md)
- [@ohos.inputMethodEngine (输入法服务)](js-apis-inputmethodengine.md)
- [@ohos.inputmethod (输入法框架)](js-apis-inputmethod.md)
- [@ohos.inputmethodengine (输入法服务)](js-apis-inputmethodengine.md)
- [@ohos.inputmethodextensionability (InputMethodExtensionAbility)](js-apis-inputmethod-extension-ability.md)
- [@ohos.inputmethodextensioncontext (InputMethodExtensionContext)](js-apis-inputmethod-extension-context.md)
- [@ohos.pasteboard (剪贴板)](js-apis-pasteboard.md)
- [@ohos.screenLock (锁屏管理)](js-apis-screen-lock.md)
- [@ohos.systemTime (系统时间、时区)](js-apis-system-time.md)
......@@ -247,12 +232,10 @@
- [@ohos.usb (USB管理)](js-apis-usb.md)
- [@ohos.vibrator (振动)](js-apis-vibrator.md)
- 帐号管理
- [@ohos.account.appAccount (应用帐号管理)](js-apis-appAccount.md)
- [@ohos.account.distributedAccount (分布式帐号管理)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (系统帐号管理)](js-apis-osAccount.md)
- 语言基础类库
- [@ohos.buffer (Buffer)](js-apis-buffer.md)
- [@ohos.convertxml (xml转换JavaScript)](js-apis-convertxml.md)
- [@ohos.process (获取进程相关的信息)](js-apis-process.md)
......@@ -279,7 +262,6 @@
- [@ohos.application.testRunner (TestRunner)](js-apis-testRunner.md)
- [@ohos.uitest (UiTest)](js-apis-uitest.md)
- 已停止维护的接口
- [@ohos.bytrace (性能打点)](js-apis-bytrace.md)
- [@ohos.data.storage (轻量级存储)](js-apis-data-storage.md)
- [@system.app (应用上下文)](js-apis-system-app.md)
......
......@@ -152,17 +152,17 @@ CommonEvent模块支持的事件类型。名称指的是系统公共事件宏;
| COMMON_EVENT_USB_DEVICE_DETACHED | usual.event.hardware.usb.action.USB_DEVICE_DETACHED | 无 | 当用户设备作为USB主机时,USB设备被卸载的公共事件的动作。 |
| COMMON_EVENT_USB_ACCESSORY_ATTACHED | usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED | 无 | 表示已连接USB附件的公共事件的动作。 |
| COMMON_EVENT_USB_ACCESSORY_DETACHED | usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED | 无 | 表示USB附件被卸载的公共事件的动作。 |
| COMMON_EVENT_DISK_REMOVED | usual.event.data.DISK_REMOVED | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为移除时发送此公共事件。 |
| COMMON_EVENT_DISK_UNMOUNTED | usual.event.data.DISK_UNMOUNTED | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为卸载时发送此公共事件。 |
| COMMON_EVENT_DISK_MOUNTED | usual.event.data.DISK_MOUNTED | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为挂载时发送此公共事件。 |
| COMMON_EVENT_DISK_BAD_REMOVAL | usual.event.data.DISK_BAD_REMOVAL | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为挂载状态下移除时发送此公共事件。 |
| COMMON_EVENT_DISK_UNMOUNTABLE | usual.event.data.DISK_UNMOUNTABLE | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为插卡情况下无法挂载时发送此公共事件。 |
| COMMON_EVENT_DISK_EJECT | usual.event.data.DISK_EJECT | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 用户已表示希望删除外部存储介质时发送此公共事件。 |
| COMMON_EVENT_VOLUME_REMOVED<sup>9+<sup> | usual.event.data.VOLUME_REMOVED | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为移除时发送此公共事件。 |
| COMMON_EVENT_VOLUME_UNMOUNTED<sup>9+<sup> | usual.event.data.VOLUME_UNMOUNTED | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为卸载时发送此公共事件。 |
| COMMON_EVENT_VOLUME_MOUNTED<sup>9+<sup> | usual.event.data.VOLUME_MOUNTED | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为挂载时发送此公共事件。 |
| COMMON_EVENT_VOLUME_BAD_REMOVAL<sup>9+<sup> | usual.event.data.VOLUME_BAD_REMOVAL | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 外部存储设备状态变更为挂载状态下移除时发送此公共事件。 |
| COMMON_EVENT_VOLUME_EJECT<sup>9+<sup> | usual.event.data.VOLUME_EJECT | ohos.permission.WRITE_USER_STORAGE 或 ohos.permission.READ_USER_STORAGE | 用户已表示希望删除外部存储介质时发送此公共事件。 |
| COMMON_EVENT_DISK_REMOVED | usual.event.data.DISK_REMOVED | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为移除时发送此公共事件。 |
| COMMON_EVENT_DISK_UNMOUNTED | usual.event.data.DISK_UNMOUNTED | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为卸载时发送此公共事件。 |
| COMMON_EVENT_DISK_MOUNTED | usual.event.data.DISK_MOUNTED | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为挂载时发送此公共事件。 |
| COMMON_EVENT_DISK_BAD_REMOVAL | usual.event.data.DISK_BAD_REMOVAL | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为挂载状态下移除时发送此公共事件。 |
| COMMON_EVENT_DISK_UNMOUNTABLE | usual.event.data.DISK_UNMOUNTABLE | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为插卡情况下无法挂载时发送此公共事件。 |
| COMMON_EVENT_DISK_EJECT | usual.event.data.DISK_EJECT | ohos.permission.STORAGE_MANAGER | 用户已表示希望删除外部存储介质时发送此公共事件。 |
| COMMON_EVENT_VOLUME_REMOVED<sup>9+<sup> | usual.event.data.VOLUME_REMOVED | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为移除时发送此公共事件。 |
| COMMON_EVENT_VOLUME_UNMOUNTED<sup>9+<sup> | usual.event.data.VOLUME_UNMOUNTED | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为卸载时发送此公共事件。 |
| COMMON_EVENT_VOLUME_MOUNTED<sup>9+<sup> | usual.event.data.VOLUME_MOUNTED | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为挂载时发送此公共事件。 |
| COMMON_EVENT_VOLUME_BAD_REMOVAL<sup>9+<sup> | usual.event.data.VOLUME_BAD_REMOVAL | ohos.permission.STORAGE_MANAGER | 外部存储设备状态变更为挂载状态下移除时发送此公共事件。 |
| COMMON_EVENT_VOLUME_EJECT<sup>9+<sup> | usual.event.data.VOLUME_EJECT | ohos.permission.STORAGE_MANAGER | 用户已表示希望删除外部存储介质时发送此公共事件。 |
| COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED | usual.event.data.VISIBLE_ACCOUNTS_UPDATED | ohos.permission.GET_APP_ACCOUNTS | 表示帐户可见更改的公共事件的动作。 |
| COMMON_EVENT_ACCOUNT_DELETED | usual.event.data.ACCOUNT_DELETED | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | 删除帐户的公共事件的动作。 |
| COMMON_EVENT_FOUNDATION_READY | usual.event.data.FOUNDATION_READY | ohos.permission.RECEIVER_STARTUP_COMPLETED | 表示foundation已准备好的公共事件的动作。 |
......
......@@ -4,6 +4,7 @@
> 该模块从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 导入模块
```js
import userFileManager from '@ohos.filemanagement.userfile_manager';
```
......@@ -36,6 +37,7 @@ getUserFileMgr(context: Context): UserFileManager
const context = getContext(this);
let userFileMgr = userfilemanager.getUserFileMgr(context);
```
## userFileManager.getUserFileMgr
getUserFileMgr(): UserFileManager
......@@ -59,9 +61,10 @@ getUserFileMgr(): UserFileManager
```js
let userFileMgr = userfilemanager.getUserFileMgr();
```
## UserFileManager
### getPublicDirectory
### getPublicDirectory
getPublicDirectory(type: DirectoryType, callback: AsyncCallback&lt;string>): void;
......
......@@ -242,8 +242,6 @@ struct FlexExample4 {
![zh-cn_image_0000001174422904](figures/zh-cn_image_0000001174422904.jpg)
![zh-cn_image_0000001219662653](figures/zh-cn_image_0000001219662653.gif)
```ts
// xxx.ets
@Component
......
......@@ -17,28 +17,28 @@
Circle(options?: {width?: string | number, height?: string | number})
- 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| width | string \| number | 否 | 0 | 宽度。 |
| height | string \| number | 否 | 0 | 高度。 |
| 参数名 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- |
| width | string \| number | 否 | 宽度。<br>默认值:0 |
| height | string \| number | 否 | 高度。<br>默认值:0 |
## 属性
除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
| 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| fill | [ResourceColor](ts-types.md) | Color.Black | 否 | 设置填充区域颜色。 |
| fillOpacity | number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](ts-types.md#resource类型) | 1 | 否 | 设置填充区域透明度。 |
| stroke | [ResourceColor](ts-types.md) | Color.Black | 否 | 设置线条颜色。 |
| strokeDashArray | Array&lt;Length&gt; | [] | 否 | 设置线条间隙。 |
| strokeDashOffset | number&nbsp;\|&nbsp;string | 0 | 否 | 线条绘制起点的偏移量。 |
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 否 | 设置线条端点绘制样式。 |
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 否 | 设置线条拐角绘制样式。 |
| strokeMiterLimit | number&nbsp;\|&nbsp;string | 4 | 否 | 设置锐角绘制成斜角的极限值。 |
| strokeOpacity | number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](ts-types.md#resource类型) | 1 | 否 | 设置线条透明度。 |
| strokeWidth | Length | 1 | 否 | 设置线条宽度。 |
| antiAlias | boolean | true | 否 | 是否开启抗锯齿效果。 |
| 参数名称 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- |
| fill | [ResourceColor](ts-types.md) | 否 | 设置填充区域颜色。<br>默认值:Color.Black |
| fillOpacity | number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](ts-types.md#resource类型) | 否 | 设置填充区域透明度。<br>默认值:1 |
| stroke | [ResourceColor](ts-types.md) | 否 | 设置线条颜色。<br>默认值:Color.Black |
| strokeDashArray | Array&lt;Length&gt; | 否 | 设置线条间隙。<br>默认值:[] |
| strokeDashOffset | number&nbsp;\|&nbsp;string | 否 | 线条绘制起点的偏移量。<br>默认值:0 |
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 否 | 设置线条端点绘制样式。<br>默认值:LineCapStyle.Butt |
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | 否 | 设置线条拐角绘制样式。<br>默认值:LineJoinStyle.Miter |
| strokeMiterLimit | number&nbsp;\|&nbsp;string | 否 | 设置锐角绘制成斜角的极限值。<br>默认值:4 |
| strokeOpacity | number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](ts-types.md#resource类型) | 否 | 设置线条透明度。<br>默认值:1 |
| strokeWidth | Length | 否 | 设置线条宽度。<br>默认值:1 |
| antiAlias | boolean | 否 | 是否开启抗锯齿效果。<br>默认值:true |
## 示例
......@@ -49,12 +49,18 @@ Circle(options?: {width?: string | number, height?: string | number})
@Component
struct CircleExample {
build() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Column({ space: 10 }) {
// 绘制一个直径为150的圆
Circle({ width: 150, height: 150 })
// 绘制一个直径为150的圆
Circle().width(150).height(150)
}.width('100%').margin({ top: 5 })
// 绘制一个直径为150、线条为红色虚线的圆环(宽高设置不一致时以短边为直径)
Circle()
.width(150)
.height(200)
.fillOpacity(0)
.strokeWidth(3)
.stroke(Color.Red)
.strokeDashArray([1, 2])
}.width('100%')
}
}
```
......
......@@ -50,12 +50,17 @@ ellipse(options?: {width?: string | number, height?: string | number})
@Component
struct EllipseExample {
build() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
// 在一个 150 * 80 的矩形框中绘制一个椭圆
Column({ space: 10 }) {
// 绘制一个 150 * 80 的椭圆
Ellipse({ width: 150, height: 80 })
// 在一个 150 * 80 的矩形框中绘制一个椭圆
Ellipse().width(150).height(80)
}.width('100%').margin({ top: 5 })
// 绘制一个 150 * 100 、线条为蓝色的椭圆环
Ellipse()
.width(150)
.height(100)
.fillOpacity(0)
.stroke(Color.Blue)
.strokeWidth(3)
}.width('100%')
}
}
```
......
......@@ -59,11 +59,29 @@ Line(value?: {width?: string | number, height?: string | number})
@Component
struct LineExample {
build() {
Column() {
Line().startPoint([0, 0]).endPoint([50, 100])
Line({ width: 50, height: 50 }).startPoint([0, 0]).endPoint([100, 100])
Line().width(200).height(200).startPoint([50, 50]).endPoint([150, 150])
}.margin({ top: 5 })
Column({ space: 10 }) {
// 线条绘制的起止点坐标均是相对于Line组件本身绘制区域的坐标
Line()
.startPoint([0, 0])
.endPoint([50, 100])
.backgroundColor('#F5F5F5')
Line()
.width(200)
.height(200)
.startPoint([50, 50])
.endPoint([150, 150])
.strokeWidth(5)
.stroke(Color.Orange)
.strokeOpacity(0.5)
.backgroundColor('#F5F5F5')
// 当坐标点设置的值超出Line组件的宽高范围时,线条会画出组件绘制区域
Line({ width: 50, height: 50 })
.startPoint([0, 0])
.endPoint([100, 100])
.strokeWidth(3)
.strokeDashArray([1, 3])
.backgroundColor('#F5F5F5')
}
}
}
```
......
......@@ -67,24 +67,75 @@ commands支持的绘制命令如下:
@Component
struct PathExample {
build() {
Column({ space: 5 }) {
Text('Straight line').fontSize(9).fontColor(0xCCCCCC).width('90%')
// 绘制一条长900px,宽3vp的直线。
Path().width(300).height(10).commands('M0 0 L900 0').stroke(Color.Black).strokeWidth(3)
Text('Straight line graph').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Path().width(100).height(100).commands('M150 0 L300 300 L0 300 Z')
Path().width(100).height(100).commands('M0 0 H300 V300 H0 Z')
Path().width(100).height(100).commands('M150 0 L0 150 L60 300 L240 300 L300 150 Z')
Column({ space: 10 }) {
Text('Straight line')
.fontSize(11)
.fontColor(0xCCCCCC)
.width('90%')
// 绘制一条长900px,宽3vp的直线
Path()
.width(300)
.height(10)
.commands('M0 0 L900 0')
.stroke(Color.Black)
.strokeWidth(3)
Text('Straight line graph')
.fontSize(11)
.fontColor(0xCCCCCC)
.width('90%')
// 绘制直线图形
Row({ space: 20 }) {
Path()
.width(100)
.height(100)
.commands('M150 0 L300 300 L0 300 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width(100)
.height(100)
.commands('M0 0 H300 V300 H0 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width(100)
.height(100)
.commands('M150 0 L0 150 L60 300 L240 300 L300 150 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
}.width('100%')
Text('Curve graphics').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Path().width(100).height(100).commands("M0 300 S150 0 300 300 Z")
Path().width(100).height(100).commands('M0 150 C0 150 150 0 300 150 L150 300 Z')
Text('Curve graphics').fontSize(11).fontColor(0xCCCCCC).width('90%')
// 绘制弧线图形
Row({ space: 20 }) {
Path()
.width(100)
.height(100)
.commands("M0 300 S150 0 300 300 Z")
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width(100)
.height(100)
.commands('M0 150 C0 150 150 0 300 150 L150 300 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width(100)
.height(100)
.commands('M0 200 A30 20 20 0 0 250 200 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
}
}.width('100%').margin({ top: 5 })
}.width('100%')
.margin({ top: 5 })
}
}
```
......
......@@ -60,16 +60,23 @@ Polygon(value?: {width?: string | number, height?: string | number})
@Component
struct PolygonExample {
build() {
Column({ space: 5 }) {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
// 在 100 * 100 的矩形框中绘制一个三角形,起点(0, 0),经过(50, 100),终点(100, 0)
Polygon({ width: 100, height: 100 }).points([[0, 0], [50, 100], [100, 0]])
// 在 100 * 100 的矩形框中绘制一个四边形,起点(0, 0),经过(0, 100)和(100, 100),终点(100, 0)
Polygon().width(100).height(100).points([[0, 0], [0, 100], [100, 100], [100, 0]])
// 在 100 * 100 的矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
Polygon().width(100).height(100).points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
}.width('100%')
}.margin({ top: 5 })
Column({ space: 10 }) {
// 在 100 * 100 的矩形框中绘制一个三角形,起点(0, 0),经过(50, 100),终点(100, 0)
Polygon({ width: 100, height: 100 })
.points([[0, 0], [50, 100], [100, 0]])
.fill(Color.Green)
// 在 100 * 100 的矩形框中绘制一个四边形,起点(0, 0),经过(0, 100)和(100, 100),终点(100, 0)
Polygon().width(100).height(100)
.points([[0, 0], [0, 100], [100, 100], [100, 0]])
.fillOpacity(0)
.strokeWidth(5)
.stroke(Color.Blue)
// 在 100 * 100 的矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
Polygon().width(100).height(100)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.fill(Color.Red)
.fillOpacity(0.6)
}.width('100%').margin({ top: 10 })
}
}
```
......
......@@ -59,14 +59,26 @@ Polyline(value?: {width?: string | number, height?: string | number})
@Component
struct PolylineExample {
build() {
Column({ space: 5 }) {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
// 在 100 * 100 的矩形框中绘制一段折线,起点(0, 0),经过(20,60),到达终点(100, 100)
Polyline({ width: 100, height: 100 }).points([[0, 0], [20, 60], [100, 100]])
// 在 100 * 100 的矩形框中绘制一段折线,起点(0, 0),经过(0,100),到达终点(100, 100)
Polyline().width(100).height(100).points([[0, 0], [0, 100], [100, 100]])
}.width('100%')
}.margin({ top: 5 })
Column({ space: 10 }) {
// 在 100 * 100 的矩形框中绘制一段折线,起点(0, 0),经过(20,60),到达终点(100, 100)
Polyline({ width: 100, height: 100 })
.points([[0, 0], [20, 60], [100, 100]])
.fillOpacity(0)
.stroke(Color.Blue)
.strokeWidth(3)
// 在 100 * 100 的矩形框中绘制一段折线,起点(20, 0),经过(0,100),到达终点(100, 90)
Polyline()
.width(100)
.height(100)
.fillOpacity(0)
.stroke(Color.Red)
.strokeWidth(8)
.points([[20, 0], [0, 100], [100, 90]])
// 设置折线拐角处为圆弧
.strokeLineJoin(LineJoinStyle.Round)
// 设置折线两端为半圆
.strokeLineCap(LineCapStyle.Round)
}.width('100%')
}
}
```
......
......@@ -58,19 +58,30 @@ Rect(value?: {width?: string | number,height?: string | number,radius?: string |
@Component
struct RectExample {
build() {
Column({ space: 5 }) {
Text('normal').fontSize(9).fontColor(0xCCCCCC).width('90%')
// 绘制90% * 50矩形
Column({ space: 10 }) {
Text('normal').fontSize(11).fontColor(0xCCCCCC).width('90%')
// 绘制90% * 50矩形
Rect({ width: '90%', height: 50 })
// 绘制90% * 50矩形
Rect().width('90%').height(50)
Text('with rounded corners').fontSize(9).fontColor(0xCCCCCC).width('90%')
// 绘制90% * 50矩形, 圆角宽高20
Rect({ width: '90%', height: 50 }).radiusHeight(20).radiusWidth(20)
// 绘制90% * 50矩形, 圆角宽高20
Rect({ width: '90%', height: 50 }).radius(20)
}.width('100%').margin({ top: 5 })
.fill(Color.Pink)
// 绘制90% * 50的矩形框
Rect()
.width('90%')
.height(50)
.fillOpacity(0)
.stroke(Color.Red)
.strokeWidth(3)
Text('with rounded corners').fontSize(11).fontColor(0xCCCCCC).width('90%')
// 绘制90% * 80的矩形, 圆角宽高分别为40、20
Rect({ width: '90%', height: 80 })
.radiusHeight(20)
.radiusWidth(40)
.fill(Color.Pink)
// 绘制90% * 80的矩形, 圆角宽高为20
Rect({ width: '90%', height: 80 })
.radius(20)
.fill(Color.Pink)
}.width('100%').margin({ top: 10 })
}
}
```
......
......@@ -48,7 +48,7 @@ Shape(value?: PixelMap)
| antiAlias | boolean | true | 否 | 是否开启抗锯齿效果。 |
| mesh<sup>8+</sup> | Array&lt;number&gt;,number,number | [],0,0 | 否 | 设置mesh效果。第一个参数为长度(column + 1)* (row + 1)* 2的数组,它记录了扭曲后的位图各个顶点位置,第二个参数为mesh矩阵列数column,第三个参数为mesh矩阵行数row。 |
## 示例
## 示例1
```ts
// xxx.ets
......@@ -56,61 +56,169 @@ Shape(value?: PixelMap)
@Component
struct ShapeExample {
build() {
Column({ space: 5 }) {
Text('basic').fontSize(30).fontColor(0xCCCCCC).width(320)
// 在Shape的(-2, -2)点绘制一个 300 * 50 带边框的矩形,颜色0x317Af7,边框颜色黑色,边框宽度4,边框间隙20,向左偏移10,尖端样式圆角,拐角样式圆角,抗锯齿(默认开启)
// 在Shape的(-2, 58)点绘制一个 300 * 50 带边框的椭圆,颜色0x317Af7,边框颜色黑色,边框宽度4,边框间隙20,向左偏移10,尖端样式圆角,拐角样式圆角,抗锯齿(默认开启)
// 在Shape的(-2, 118)点绘制一个 300 * 10 线段,颜色0x317Af7,边框颜色黑色,宽度4,间隙20,向左偏移10,尖端样式圆角,拐角样式圆角,抗锯齿(默认开启)
Column({ space: 10 }) {
Text('basic').fontSize(11).fontColor(0xCCCCCC).width(320)
// 在Shape的(-2, -2)点绘制一个 300 * 50 带边框的矩形,颜色0x317AF7,边框颜色黑色,边框宽度4,边框间隙20,向左偏移10,线条两端样式为半圆,拐角样式圆角,抗锯齿(默认开启)
// 在Shape的(-2, 58)点绘制一个 300 * 50 带边框的椭圆,颜色0x317AF7,边框颜色黑色,边框宽度4,边框间隙20,向左偏移10,线条两端样式为半圆,拐角样式圆角,抗锯齿(默认开启)
// 在Shape的(-2, 118)点绘制一个 300 * 10 直线路径,颜色0x317AF7,边框颜色黑色,宽度4,间隙20,向左偏移10,线条两端样式为半圆,拐角样式圆角,抗锯齿(默认开启)
Shape() {
Rect().width(300).height(50)
Ellipse().width(300).height(50).offset({ x: 0, y: 60 })
Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 })
}
.viewPort({ x: -2, y: -2, width: 304, height: 130 })
.fill(0x317Af7).stroke(Color.Black).strokeWidth(4)
.strokeDashArray([20]).strokeDashOffset(10).strokeLineCap(LineCapStyle.Round)
.strokeLineJoin(LineJoinStyle.Round).antiAlias(true)
// 在Shape的(-1, -1)点绘制一个 300 * 50 带边框的矩形,颜色0x317Af7,边框颜色黑色,边框宽度2
.fill(0x317AF7)
.stroke(Color.Black)
.strokeWidth(4)
.strokeDashArray([20])
.strokeDashOffset(10)
.strokeLineCap(LineCapStyle.Round)
.strokeLineJoin(LineJoinStyle.Round)
.antiAlias(true)
// 分别在Shape的(0, 0)、(-5, -5)点绘制一个 300 * 50 带边框的矩形,可以看出之所以将视口的起始位置坐标设为负值是因为绘制的起点默认为线宽的中点位置,因此要让边框完全显示则需要让视口偏移半个线宽
Shape() {
Rect().width(300).height(50)
}.viewPort({ x: -1, y: -1, width: 302, height: 52 }).fill(0x317Af7).stroke(Color.Black).strokeWidth(2)
}
.viewPort({ x: 0, y: 0, width: 320, height: 70 })
.fill(0x317AF7)
.stroke(Color.Black)
.strokeWidth(10)
Text('border').fontSize(30).fontColor(0xCCCCCC).width(320).margin({top:30})
// 在Shape的(0, -5)点绘制一个 300 * 10 直线,颜色0xEE8443,边框宽度10,边框间隙20
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}.viewPort({ x: 0, y: -5, width: 300, height: 20 }).stroke(0xEE8443).strokeWidth(10).strokeDashArray([20])
// 在Shape的(0, -5)点绘制一个 300 * 10 直线,颜色0xEE8443,边框宽度10,边框间隙20,向左偏移10
Rect().width(300).height(50)
}
.viewPort({ x: -5, y: -5, width: 320, height: 70 })
.fill(0x317AF7)
.stroke(Color.Black)
.strokeWidth(10)
Text('path').fontSize(11).fontColor(0xCCCCCC).width(320)
// 在Shape的(0, -5)点绘制一条直线路径,颜色0xEE8443,线条宽度10,线条间隙20
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443).strokeWidth(10).strokeDashArray([20]).strokeDashOffset(10)
// 在Shape的(0, -5)点绘制一个 300 * 10 直线,颜色0xEE8443,边框宽度10,透明度0.5
.stroke(0xEE8443)
.strokeWidth(10)
.strokeDashArray([20])
// 在Shape的(0, -5)点绘制一条直线路径,颜色0xEE8443,线条宽度10,线条间隙20,向左偏移10
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}.viewPort({ x: 0, y: -5, width: 300, height: 20 }).stroke(0xEE8443).strokeWidth(10).strokeOpacity(0.5)
// 在Shape的(0, -5)点绘制一个 300 * 10 直线,颜色0xEE8443,边框宽度10,边框间隙20,向左偏移10,尖端样式圆角
}
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443)
.strokeWidth(10)
.strokeDashArray([20])
.strokeDashOffset(10)
// 在Shape的(0, -5)点绘制一条直线路径,颜色0xEE8443,线条宽度10,透明度0.5
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443).strokeWidth(10).strokeDashArray([20]).strokeLineCap(LineCapStyle.Round)
// 在Shape的(-5, -5)点绘制一个 300 * 50 带边框的矩形,颜色0x317Af7,边框宽度10,边框颜色0xEE8443,拐角样式圆角
.stroke(0xEE8443)
.strokeWidth(10)
.strokeOpacity(0.5)
// 在Shape的(0, -5)点绘制一条直线路径,颜色0xEE8443,线条宽度10,线条间隙20,线条两端样式为半圆
Shape() {
Rect().width(300).height(100)
Path().width(300).height(10).commands('M0 0 L900 0')
}
.viewPort({ x: -5, y: -5, width: 310, height: 120 })
.fill(0x317Af7).stroke(0xEE8443).strokeWidth(10).strokeLineJoin(LineJoinStyle.Round)
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443)
.strokeWidth(10)
.strokeDashArray([20])
.strokeLineCap(LineCapStyle.Round)
// 在Shape的(-80, -5)点绘制一个封闭路径,颜色0x317AF7,线条宽度10,边框颜色0xEE8443,拐角样式锐角(默认值)
Shape() {
Path().width(300).height(60).commands('M0 0 L400 0 L400 200 Z')
Path().width(200).height(60).commands('M0 0 L400 0 L400 150 Z')
}
.viewPort({ x: -80, y: -5, width: 310, height: 100 })
.fill(0x317Af7).stroke(0xEE8443).strokeWidth(10)
.strokeLineJoin(LineJoinStyle.Miter).strokeMiterLimit(5)
.viewPort({ x: -80, y: -5, width: 310, height: 90 })
.fill(0x317AF7)
.stroke(0xEE8443)
.strokeWidth(10)
.strokeLineJoin(LineJoinStyle.Miter)
.strokeMiterLimit(5)
}.width('100%').margin({ top: 15 })
}
}
```
![zh-cn_image_0000001184628104](figures/zh-cn_image_0000001184628104.png)
## 示例2
```ts
// xxx.ets
@Entry
@Component
struct ShapeMeshExample {
@State columnVal: number = 0;
@State rowVal: number = 0;
@State count: number = 0;
@State verts: Array<number> = [];
@State shapeWidth: number = 600;
@State shapeHeight: number = 600;
build() {
Column() {
Shape() {
Rect()
.width('250px')
.height('250px')
.radiusWidth('10px')
.radiusHeight('10px')
.stroke('10px')
.margin({ left: '10px', top: '10px' })
.strokeWidth('10px')
.fill(Color.Blue)
Rect()
.width('250px')
.height('250px')
.radiusWidth('10px')
.radiusHeight('10px')
.stroke('10px')
.margin({ left: '270px', top: '10px' })
.strokeWidth('10px')
.fill(Color.Red)
}
.mesh(this.verts, this.columnVal, this.rowVal)
.width(this.shapeWidth + 'px')
.height(this.shapeHeight + 'px')
// 手指触摸Shape组件时会显示mesh扭曲效果
.onTouch((event: TouchEvent) => {
var touchX = event.touches[0].x * 2;
var touchY = event.touches[0].y * 2;
this.columnVal = 20;
this.rowVal = 20;
this.count = (this.columnVal + 1) * (this.rowVal + 1);
var orig = [this.count * 2];
var index = 0;
for (var i = 0; i <= this.rowVal; i++) {
var fy = this.shapeWidth * i / this.rowVal;
for (var j = 0; j <= this.columnVal; j++) {
var fx = this.shapeWidth * j / this.columnVal;
orig[index * 2 + 0] = this.verts[index * 2 + 0] = fx;
orig[index * 2 + 1] = this.verts[index * 2 + 1] = fy;
index++;
}
}
for (var k = 0; k < this.count * 2; k += 2) {
var dx = touchX - orig[k + 0];
var dy = touchY - orig[k + 1];
var dd = dx * dx + dy * dy;
var d = Math.sqrt(dd);
var pull = 80000 / (dd * d);
if (pull >= 1) {
this.verts[k + 0] = touchX;
this.verts[k + 1] = touchY;
} else {
this.verts[k + 0] = orig[k + 0] + dx * pull;
this.verts[k + 1] = orig[k + 1] + dy * pull;
}
}
})
}
.width('600px')
.height('600px')
.border({ width: 3, color: Color.Black })
}
}
```
# Native API
- 模块
- [Native XComponent](_o_h___native_x_component.md)
- [HiLog](_hi_log.md)
- [NativeWindow](_native_window.md)
- [OH_NativeBuffer](_o_h___native_buffer.md)
- [Drawing](_drawing.md)
- [OH_NativeImage](_o_h___native_image.md)
- [NativeVsync](_native_vsync.md)
- [Image](image.md)
- [Rawfile](rawfile.md)
- [MindSpore](_mind_spore.md)
- [Native XComponent](_o_h___native_x_component.md)
- [HiLog](_hi_log.md)
- [NativeWindow](_native_window.md)
- [OH_NativeBuffer](_o_h___native_buffer.md)
- [Drawing](_drawing.md)
- [OH_NativeImage](_o_h___native_image.md)
- [NativeVsync](_native_vsync.md)
- [Image](image.md)
- [Rawfile](rawfile.md)
- [MindSpore](_mind_spore.md)
- 头文件
- [drawing_bitmap.h](drawing__bitmap_8h.md)
- [drawing_brush.h](drawing__brush_8h.md)
- [drawing_canvas.h](drawing__canvas_8h.md)
- [drawing_color.h](drawing__color_8h.md)
- [drawing_font_collection.h](drawing__font__collection_8h.md)
- [drawing_path.h](drawing__path_8h.md)
- [drawing_pen.h](drawing__pen_8h.md)
- [drawing_text_declaration.h](drawing__text__declaration_8h.md)
- [drawing_text_typography.h](drawing__text__typography_8h.md)
- [drawing_types.h](drawing__types_8h.md)
- [external_window.h](external__window_8h.md)
- [image_pixel_map_napi.h](image__pixel__map__napi_8h.md)
- [log.h](log_8h.md)
- [native_buffer.h](native__buffer_8h.md)
- [native_image.h](native__image_8h.md)
- [native_interface_xcomponent.h](native__interface__xcomponent_8h.md)
- [native_vsync.h](native__vsync_8h.md)
- [raw_dir.h](raw__dir_8h.md)
- [raw_file_manager.h](raw__file__manager_8h.md)
- [raw_file.h](raw__file_8h.md)
- [context.h](context_8h.md)
- [data_type.h](data__type_8h.md)
- [format.h](format_8h.md)
- [model.h](model_8h.md)
- [status.h](status_8h.md)
- [tensor.h](tensor_8h.md)
- [types.h](types_8h.md)
- [drawing_bitmap.h](drawing__bitmap_8h.md)
- [drawing_brush.h](drawing__brush_8h.md)
- [drawing_canvas.h](drawing__canvas_8h.md)
- [drawing_color.h](drawing__color_8h.md)
- [drawing_font_collection.h](drawing__font__collection_8h.md)
- [drawing_path.h](drawing__path_8h.md)
- [drawing_pen.h](drawing__pen_8h.md)
- [drawing_text_declaration.h](drawing__text__declaration_8h.md)
- [drawing_text_typography.h](drawing__text__typography_8h.md)
- [drawing_types.h](drawing__types_8h.md)
- [external_window.h](external__window_8h.md)
- [image_pixel_map_napi.h](image__pixel__map__napi_8h.md)
- [log.h](log_8h.md)
- [native_buffer.h](native__buffer_8h.md)
- [native_image.h](native__image_8h.md)
- [native_interface_xcomponent.h](native__interface__xcomponent_8h.md)
- [native_vsync.h](native__vsync_8h.md)
- [raw_dir.h](raw__dir_8h.md)
- [raw_file_manager.h](raw__file__manager_8h.md)
- [raw_file.h](raw__file_8h.md)
- [context.h](context_8h.md)
- [data_type.h](data__type_8h.md)
- [format.h](format_8h.md)
- [model.h](model_8h.md)
- [status.h](status_8h.md)
- [tensor.h](tensor_8h.md)
- [types.h](types_8h.md)
- 结构体
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)
- [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)
- [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md)
- [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md)
- [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)
- [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)
- [OHExtDataHandle](_o_h_ext_data_handle.md)
- [OHHDRMetaData](_o_h_h_d_r_meta_data.md)
- [OhosPixelMapInfo](_ohos_pixel_map_info.md)
- [RawFileDescriptor](_raw_file_descriptor.md)
- [Region](_region.md)
- [Rect](_rect.md)
- [OH_AI_CallBackParam](_o_h___a_i___call_back_param.md)
- [OH_AI_ShapeInfo](_o_h___a_i___shape_info.md)
- [OH_AI_TensorHandleArray](_o_h___a_i___tensor_handle_array.md)
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)
- [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)
- [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md)
- [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md)
- [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)
- [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)
- [OHExtDataHandle](_o_h_ext_data_handle.md)
- [OHHDRMetaData](_o_h_h_d_r_meta_data.md)
- [OhosPixelMapInfo](_ohos_pixel_map_info.md)
- [RawFileDescriptor](_raw_file_descriptor.md)
- [Region](_region.md)
- [Rect](_rect.md)
- [OH_AI_CallBackParam](_o_h___a_i___call_back_param.md)
- [OH_AI_ShapeInfo](_o_h___a_i___shape_info.md)
- [OH_AI_TensorHandleArray](_o_h___a_i___tensor_handle_array.md)
......@@ -2,7 +2,8 @@
- 访问控制
- [访问控制(权限)开发概述](accesstoken-overview.md)
- [访问控制(权限)开发指导](accesstoken-guidelines.md)
- [访问控制授权申请指导](accesstoken-guidelines.md)
- [访问控制权限校验指导](permission-verify-guidelines.md)
- [应用权限列表](permission-list.md)
- 用户认证
- [用户认证开发概述](userauth-overview.md)
......
......@@ -37,13 +37,12 @@
- [测试框架使用指导](ability/ability-delegator.md)
- UI开发
- [方舟开发框架(ArkUI)概述](ui/arkui-overview.md)
- 基于TS扩展的声明式开发范式
- 基于eTS的声明式开发范式
- [概述](ui/ui-ts-overview.md)
- 框架说明
- 文件组织
- [目录结构](ui/ts-framework-directory.md)
- [应用代码文件访问规则](ui/ts-framework-file-access-rules.md)
- [js标签配置](ui/ts-framework-js-tag.md)
- 资源管理
- [资源文件的分类](ui/ui-ts-basic-resource-file-categories.md)
- [资源访问](ui/ts-resource-access.md)
......@@ -108,7 +107,7 @@
- [构建食物分类Grid布局](ui/ui-ts-building-category-grid-layout.md)
- [页面跳转与数据传递](ui/ui-ts-page-redirection-data-transmission.md)
- [性能提升的推荐方法](ui/ts-performance-improvement-recommendation.md)
- 基于JS扩展的类Web开发范式
- 兼容JS的类Web开发范式
- [概述](ui/ui-js-overview.md)
- 框架说明
- [文件组织](ui/js-framework-file.md)
......@@ -202,6 +201,7 @@
- [音频播放开发指导](media/audio-playback.md)
- [音频录制开发指导](media/audio-recorder.md)
- [音频渲染开发指导](media/audio-renderer.md)
- [音频流管理开发指导](media/audio-stream-manager.md)
- [音频采集开发指导](media/audio-capturer.md)
- [OpenSL ES播放开发指导](media/opensles-playback.md)
- [OpenSL ES录音开发指导](media/opensles-capture.md)
......@@ -213,10 +213,12 @@
- [图片开发指导](media/image.md)
- 相机
- [相机开发指导](media/camera.md)
- [分布式相机开发指导](media/remote-camera.md)
- 安全
- 访问控制
- [访问控制开发概述](security/accesstoken-overview.md)
- [访问控制开发指导](security/accesstoken-guidelines.md)
- [访问控制授权申请指导](security/accesstoken-guidelines.md)
- [访问控制权限校验指导](security/permission-verify-guidelines.md)
- [权限定义列表](security/permission-list.md)
- 用户认证
- [用户认证开发概述](security/userauth-overview.md)
......@@ -301,78 +303,66 @@
- [Intl开发指导](internationalization/intl-guidelines.md)
- [I18n开发指导](internationalization/i18n-guidelines.md)
- 一次开发,多端部署
- [前言](key-features/multi-device-app-dev/about-this-document.md)
- [前言](key-features/multi-device-app-dev/foreword.md)
- [简介](key-features/multi-device-app-dev/introduction.md)
- [从一个例子开始](key-features/multi-device-app-dev/start-with-a-example.md)
- 应用UX设计
- [设计原则和要点](key-features/multi-device-app-dev/design-principles.md)
- 应用架构设计
- [应用导航结构设计要求](key-features/multi-device-app-dev/navigation-design.md)
- [应用页面结构设计](key-features/multi-device-app-dev/page-design.md)
- 界面布局
- [概述](key-features/multi-device-app-dev/layout-design-intro.md)
- [概述](key-features/multi-device-app-dev/interface-layout-design-intro.md)
- 布局基础
- [栅格系统](key-features/multi-device-app-dev/layout-grid.md)
- [自适应布局](key-features/multi-device-app-dev/layout-adaptive.md)
- [响应式布局](key-features/multi-device-app-dev/layout-responsive.md)
- [布局基础运用案例](key-features/multi-device-app-dev/layout-design-cases.md)
- [栅格系统](key-features/multi-device-app-dev/design-grid.md)
- [自适应布局](key-features/multi-device-app-dev/design-adaptive-layout.md)
- [响应式布局](key-features/multi-device-app-dev/design-responsive-layout.md)
- [布局基础运用案例](key-features/multi-device-app-dev/design-layout-cases.md)
- 人机交互
- [交互基础](key-features/multi-device-app-dev/interaction-basics.md)
- [常见输入方式](key-features/multi-device-app-dev/common-input-modes.md)
- [交互事件归一](key-features/multi-device-app-dev/design-interaction-events-unification.md)
- [交互事件归一](key-features/multi-device-app-dev/design-interaction-event-normalization.md)
- 视觉风格
- [视觉基础](key-features/multi-device-app-dev/visual-style-basics.md)
- [视觉基础](key-features/multi-device-app-dev/visual-basics.md)
- [色彩](key-features/multi-device-app-dev/visual-style-color.md)
- [字体](key-features/multi-device-app-dev/visual-style-font.md)
- [图标](key-features/multi-device-app-dev/visual-style-icon.md)
- [多态控件](key-features/multi-device-app-dev/design-polymorphic-components.md)
- [多态控件](key-features/multi-device-app-dev/design-polymorphic-controls.md)
- [设计自检表](key-features/multi-device-app-dev/design-checklist.md)
- [资源](key-features/multi-device-app-dev/resource.md)
- [IDE使用](key-features/multi-device-app-dev/ide-usage.md)
- 一多能力的页面开发介绍
- 布局能力
- [布局能力简介](key-features/multi-device-app-dev/layout-intro.md)
- 自适应布局
- [自适应布局简介](key-features/multi-device-app-dev/adaptive-layout-intro.md)
- [拉伸能力](key-features/multi-device-app-dev/adaptive-layout-stretching.md)
- [均分能力](key-features/multi-device-app-dev/adaptive-layout-equalization.md)
- [占比能力](key-features/multi-device-app-dev/adaptive-layout-proportion.md)
- [缩放能力](key-features/multi-device-app-dev/adaptive-layout-scaling.md)
- [延伸能力](key-features/multi-device-app-dev/adaptive-layout-extension.md)
- [隐藏能力](key-features/multi-device-app-dev/adaptive-layout-hiding.md)
- [折行能力](key-features/multi-device-app-dev/adaptive-layout-wrapping.md)
- 响应式布局
- [栅格断点系统](key-features/multi-device-app-dev/grid-breakpoint.md)
- [媒体查询](key-features/multi-device-app-dev/media-query.md)
- [典型场景](key-features/multi-device-app-dev/responsive-layout-cases.md)
- [交互归一](key-features/multi-device-app-dev/interaction-events-unification.md)
- [多态组件](key-features/multi-device-app-dev/polymorphic-components.md)
- [资源使用](key-features/multi-device-app-dev/resource-usage.md)
- [一多能力的功能开发介绍](key-features/multi-device-app-dev/development-intro.md)
- 案例应用
- 短信应用
- [概览](key-features/multi-device-app-dev/sms-intro.md)
- 会话详情页面
- [页面结构](key-features/multi-device-app-dev/sms-session-page-structure.md)
- [顶部标题栏](key-features/multi-device-app-dev/sms-session-page-title-bar.md)
- [底部输入栏](key-features/multi-device-app-dev/sms-session-page-input-field.md)
- [信息列表](key-features/multi-device-app-dev/sms-session-page-message-list.md)
- [组合成型](key-features/multi-device-app-dev/sms-session-page-combined.md)
- [总结](key-features/multi-device-app-dev/sms-session-summary.md)
- [桌面应用](key-features/multi-device-app-dev/cases-home-screen.md)
- [常见问题](key-features/multi-device-app-dev/faqs.md)
- [设计交付](key-features/multi-device-app-dev/design-delivery.md)
- [资源](key-features/multi-device-app-dev/design-resources.md)
- [工程管理](key-features/multi-device-app-dev/ide-using.md)
- 页面开发的一多能力介绍
- [简介](key-features/multi-device-app-dev/page-development-intro.md)
- 布局能力
- [布局简介](key-features/multi-device-app-dev/layout-intro.md)
- [自适应布局](key-features/multi-device-app-dev/adaptive-layout.md)
- [响应式布局](key-features/multi-device-app-dev/responsive-layout.md)
- [典型布局场景](key-features/multi-device-app-dev/typical-layout-scenario.md)
- 典型页面场景
- [应用市场首页](key-features/multi-device-app-dev/appgallery-home-page.md)
- [音乐专辑页](key-features/multi-device-app-dev/music-album-page.md)
- [交互归一](key-features/multi-device-app-dev/interaction-event-normalization.md)
- [多态组件](key-features/multi-device-app-dev/polymorphic-controls.md)
- [资源使用](key-features/multi-device-app-dev/resource-usage.md)
- [功能开发的一多能力介绍](key-features/multi-device-app-dev/development-intro.md)
- [案例应用](key-features/multi-device-app-dev/case.md)
- [常见问题](key-features/multi-device-app-dev/faq.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- Native API的相关指导
- [Native API在应用工程中的使用指导](napi/napi-guidelines.md)
- [Drawing开发指导](napi/drawing-guidelines.md)
- [Rawfile开发指导](napi/rawfile-guidelines.md)
- [Window开发指导](napi/native-window-guidelines.md)
- [使用MindSpore Lite引擎进行模型推理](napi/mindspore-lite-guidelines.md)
- 工具
- [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md)
- 示例教程
- [示例代码](https://gitee.com/openharmony/applications_app_samples/blob/master/README_zh.md)
- [Codelabs](https://gitee.com/openharmony/codelabs/blob/master/README.md)
- API参考
- 组件参考(基于TS扩展的声明式开发范式)
- [Syscap列表](reference/syscap-list.md)
- 组件参考(基于eTS的声明式开发范式)
- 组件通用信息
- 通用事件
- [点击事件](reference/arkui-ts/ts-universal-events-click.md)
......@@ -412,6 +402,8 @@
- [触摸热区设置](reference/arkui-ts/ts-universal-attributes-touch-target.md)
- [多态样式](reference/arkui-ts/ts-universal-attributes-polymorphic-style.md)
- [触摸测试控制](reference/arkui-ts/ts-universal-attributes-hit-test-behavior.md)
- [背景模糊设置](reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md)
- [分布式迁移标识](reference/arkui-ts/ts-universal-attributes-restoreId.md)
- 手势处理
- [绑定手势方法](reference/arkui-ts/ts-gesture-settings.md)
- 基础手势
......@@ -470,10 +462,13 @@
- [Counter](reference/arkui-ts/ts-container-counter.md)
- [Flex](reference/arkui-ts/ts-container-flex.md)
- [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md)
- [GridCol](reference/arkui-ts/ts-container-gridcol.md)
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [ListItemGroup](reference/arkui-ts/ts-container-listitemgroup.md)
- [Navigator](reference/arkui-ts/ts-container-navigator.md)
- [Panel](reference/arkui-ts/ts-container-panel.md)
- [Refresh](reference/arkui-ts/ts-container-refresh.md)
......@@ -527,7 +522,7 @@
- [菜单](reference/arkui-ts/ts-methods-menu.md)
- [枚举说明](reference/arkui-ts/ts-appendix-enums.md)
- [类型说明](reference/arkui-ts/ts-types.md)
- 组件参考(基于JS扩展的类Web开发范式)
- 组件参考(兼容JS的类Web开发范式)
- 组件通用信息
- [通用属性](reference/arkui-js/js-components-common-attributes.md)
- [通用样式](reference/arkui-js/js-components-common-styles.md)
......@@ -727,6 +722,7 @@
- [ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md)
- [MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md)
- [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md)
- [ProcessRunningInformation (ProcessRunningInformation)](reference/apis/js-apis-processrunninginformation.md)
- [shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md)
- [ContinuationResult (ContinuationResult)](reference/apis/js-apis-continuation-continuationResult.md)
- 公共事件与通知
......@@ -746,6 +742,7 @@
- [ApplicationInfo (ApplicationInfo)](reference/apis/js-apis-bundle-ApplicationInfo.md)
- [BundleInfo (BundleInfo)](reference/apis/js-apis-bundle-BundleInfo.md)
- [BundleInstaller (BundleInstaller)](reference/apis/js-apis-bundle-BundleInstaller.md)
- [BundleStatusCallback (BundleStatusCallback)](reference/apis/js-apis-Bundle-BundleStatusCallback.md)
- [CustomizeData (CustomizeData)](reference/apis/js-apis-bundle-CustomizeData.md)
- [DispatchInfo (DispatchInfo)](reference/apis/js-apis-dispatchInfo.md)
- [ElementName (ElementName)](reference/apis/js-apis-bundle-ElementName.md)
......@@ -768,6 +765,7 @@
- [@ohos.animation.windowAnimationManager (窗口动画管理)](reference/apis/js-apis-windowAnimationManager.md)
- [@ohos.display (屏幕属性)](reference/apis/js-apis-display.md)
- [@ohos.effectKit (图像效果)](reference/apis/js-apis-effectKit.md)
- [@ohos.graphics.colorSpaceManager(色彩管理)](reference/apis/js-apis-colorSpaceManager.md)
- [@ohos.screen (屏幕)](reference/apis/js-apis-screen.md)
- [@ohos.screenshot (屏幕截图)](reference/apis/js-apis-screenshot.md)
- [@ohos.window (窗口)](reference/apis/js-apis-window.md)
......@@ -778,7 +776,6 @@
- [@ohos.multimedia.camera (相机管理)](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image (图片处理)](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media (媒体服务)](reference/apis/js-apis-media.md)
- [@ohos.multimedia.medialibrary (媒体库管理)](reference/apis/js-apis-medialibrary.md)
- 资源管理
- [@ohos.i18n (国际化-I18n)](reference/apis/js-apis-i18n.md)
- [@ohos.intl (国际化-Intl)](reference/apis/js-apis-intl.md)
......@@ -790,12 +787,14 @@
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理
- [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager (企业设备管理)](reference/apis/js-apis-enterprise-device-manager.md)
- [@ohos.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterpriseDeviceManager (企业设备管理)](reference/apis/js-apis-enterprise-device-manager.md)
- [DeviceSettingsManager(设备设置管理)](reference/apis/js-apis-enterpriseDeviceManager-DeviceSettingsManager.md)
- 安全
- [@ohos.abilityAccessCtrl (访问控制管理)](reference/apis/js-apis-abilityAccessCtrl.md)
- [@ohos.privacyManager (隐私管理)](reference/apis/js-apis-privacyManager.md)
- [@ohos.security.huks (通用密钥库系统)](reference/apis/js-apis-huks.md)
- [@ohos.userIAM.faceAuth (人脸认证)](reference/apis/js-apis-useriam-faceauth.md)
- [@ohos.userIAM.userAuth (用户认证)](reference/apis/js-apis-useriam-userauth.md)
- [@system.cipher (加密算法)](reference/apis/js-apis-system-cipher.md)
- 数据管理
......@@ -814,24 +813,31 @@
- [@ohos.environment (目录环境能力)](reference/apis/js-apis-environment.md)
- [@ohos.fileio (文件管理)](reference/apis/js-apis-fileio.md)
- [@ohos.fileManager (公共文件访问与管理)](reference/apis/js-apis-filemanager.md)
[@ohos.filemanagement.userfile_manager (用户数据管理)](reference/apis/js-apis-userfilemanager.md)
- [@ohos.multimedia.medialibrary (媒体库管理)](reference/apis/js-apis-medialibrary.md)
- [@ohos.securityLabel (数据标签)](reference/apis/js-apis-securityLabel.md)
- [@ohos.statfs (statfs)](reference/apis/js-apis-statfs.md)
- [@ohos.storageStatistics (应用空间统计)](reference/apis/js-apis-storage-statistics.md)
- [@ohos.volumeManager (卷管理)](reference/apis/js-apis-volumemanager.md)
- [@ohos.securityLabel (数据标签)](reference/apis/js-apis-securityLabel.md)
- 电话服务
- [@ohos.contact (联系人)](reference/apis/js-apis-contact.md)
- [@ohos.telephony.call (拨打电话)](reference/apis/js-apis-call.md)
- [@ohos.telephony.data (蜂窝数据)](reference/apis/js-apis-telephony-data.md)
- [@ohos.telephony.observer (observer)](reference/apis/js-apis-observer.md)
- [@ohos.telephony.radio (网络搜索)](reference/apis/js-apis-radio.md)
- [@ohos.telephony.sim (SIM卡管理)](reference/apis/js-apis-sim.md)
- [@ohos.telephony.sms (短信服务)](reference/apis/js-apis-sms.md)
- [@ohos.telephony.data (蜂窝数据)](reference/apis/js-apis-telephony-data.md)
- 网络管理
- [@ohos.net.connection (网络连接管理)](reference/apis/js-apis-net-connection.md)
- [@ohos.net.ethernet (以太网连接管理)](reference/apis/js-apis-net-ethernet.md)
- [@ohos.net.http (数据请求)](reference/apis/js-apis-http.md)
- [@ohos.request (上传下载)](reference/apis/js-apis-request.md)
- [@ohos.net.policy (网络策略管理)](reference/apis/js-apis-net-policy.md)
- [@ohos.net.sharing (网络共享管理)](reference/apis/js-apis-net-sharing.md)
- [@ohos.net.socket (Socket连接)](reference/apis/js-apis-socket.md)
- [@ohos.net.statistics (网络流量管理)](reference/apis/js-apis-net-statistics.md)
- [@ohos.net.tlsSocket (TLSSocket连接)](reference/apis/js-apis-tlsSocket.md)
- [@ohos.net.webSocket (WebSocket连接)](reference/apis/js-apis-webSocket.md)
- [@ohos.request (上传下载)](reference/apis/js-apis-request.md)
- 通信与连接
- [@ohos.bluetooth (蓝牙)](reference/apis/js-apis-bluetooth.md)
- [@ohos.connectedTag (有源标签)](reference/apis/js-apis-connectedTag.md)
......@@ -841,8 +847,11 @@
- [@ohos.rpc (RPC通信)](reference/apis/js-apis-rpc.md)
- [@ohos.wifi (WLAN)](reference/apis/js-apis-wifi.md)
- [@ohos.wifiext (WLAN)](reference/apis/js-apis-wifiext.md)
- [nfctech (标准NFC-Tag Nfc 技术)](reference/apis/js-apis-nfctech.md)
- [tagSession (标准NFC-Tag TagSession)](reference/apis/js-apis-tagSession.md)
- 系统基础能力
- [@ohos.accessibility (辅助功能)](reference/apis/js-apis-accessibility.md)
- [@ohos.accessibility.config (系统辅助功能配置)](reference/apis/js-apis-accessibility-config.md)
- [@ohos.faultLogger (故障日志获取)](reference/apis/js-apis-faultLogger.md)
- [@ohos.hiAppEvent (应用打点)](reference/apis/js-apis-hiappevent.md)
- [@ohos.hichecker (检测模式)](reference/apis/js-apis-hichecker.md)
......@@ -853,11 +862,13 @@
- [@ohos.hiTraceMeter (性能打点)](reference/apis/js-apis-hitracemeter.md)
- [@ohos.inputMethod (输入法框架)](reference/apis/js-apis-inputmethod.md)
- [@ohos.inputMethodEngine (输入法服务)](reference/apis/js-apis-inputmethodengine.md)
- [@ohos.inputmethodextensionability (InputMethodExtensionAbility)](reference/apis/js-apis-inputmethod-extension-ability.md)
- [@ohos.inputmethodextensioncontext (InputMethodExtensionContext)](reference/apis/js-apis-inputmethod-extension-context.md)
- [@ohos.pasteboard (剪贴板)](reference/apis/js-apis-pasteboard.md)
- [@ohos.screenLock (锁屏管理)](reference/apis/js-apis-screen-lock.md)
- [@ohos.systemTime (设置系统时间)](reference/apis/js-apis-system-time.md)
- [@ohos.systemTime (系统时区、时间)](reference/apis/js-apis-system-time.md)
- [@ohos.systemTimer(系统定时器)](reference/apis/js-apis-system-timer.md)
- [@ohos.wallpaper (壁纸)](reference/apis/js-apis-wallpaper.md)
- [@ohos.systemTimer(设置系统时间)](reference/apis/js-apis-system-timer.md)
- [Timer (定时器)](reference/apis/js-apis-timer.md)
- 设备管理
- [@ohos.batteryInfo (电量信息)](reference/apis/js-apis-battery-info.md)
......@@ -873,6 +884,7 @@
- [@ohos.multimodalInput.keyCode (键值)](reference/apis/js-apis-keycode.md)
- [@ohos.multimodalInput.keyEvent (按键输入事件)](reference/apis/js-apis-keyevent.md)
- [@ohos.multimodalInput.mouseEvent (鼠标输入事件)](reference/apis/js-apis-mouseevent.md)
- [@ohos.multimodalInput.pointer (鼠标指针)](reference/apis/js-apis-pointer.md)
- [@ohos.multimodalInput.touchEvent (触摸输入事件)](reference/apis/js-apis-touchevent.md)
- [@ohos.power (系统电源管理)](reference/apis/js-apis-power.md)
- [@ohos.runningLock (Runninglock锁)](reference/apis/js-apis-runninglock.md)
......@@ -888,6 +900,7 @@
- [@ohos.account.distributedAccount (分布式帐号管理)](reference/apis/js-apis-distributed-account.md)
- [@ohos.account.osAccount (系统帐号管理)](reference/apis/js-apis-osAccount.md)
- 语言基础类库
- [@ohos.buffer (Buffer)](reference/apis/js-apis-buffer.md)
- [@ohos.convertxml (xml转换JavaScript)](reference/apis/js-apis-convertxml.md)
- [@ohos.process (获取进程相关的信息)](reference/apis/js-apis-process.md)
- [@ohos.uri (URI字符串解析)](reference/apis/js-apis-uri.md)
......@@ -940,9 +953,11 @@
- [Native XComponent](reference/native-apis/_o_h___native_x_component.md)
- [HiLog](reference/native-apis/_hi_log.md)
- [NativeWindow](reference/native-apis/_native_window.md)
- [OH_NativeBuffer](reference/native-apis/_o_h___native_buffer.md)
- [Drawing](reference/native-apis/_drawing.md)
- [OH_NativeImage](reference/native-apis/_o_h___native_image.md)
- [NativeVsync](reference/native-apis/_native_vsync.md)
- [Image](reference/native-apis/image.md)
- [Rawfile](reference/native-apis/rawfile.md)
- 头文件
- [drawing_bitmap.h](reference/native-apis/drawing__bitmap_8h.md)
......@@ -973,8 +988,12 @@
- [OH_NativeXComponent_MouseEvent_Callback](reference/native-apis/_o_h___native_x_component___mouse_event___callback.md)
- [OH_NativeXComponent_TouchEvent](reference/native-apis/_o_h___native_x_component___touch_event.md)
- [OH_NativeXComponent_TouchPoint](reference/native-apis/_o_h___native_x_component___touch_point.md)
- [OHExtDataHandle](reference/native-apis/_o_h_ext_data_handle.md)
- [OHHDRMetaData](reference/native-apis/_o_h_h_d_r_meta_data.md)
- [OhosPixelMapInfo](reference/native-apis/_ohos_pixel_map_info.md)
- [RawFileDescriptor](reference/native-apis/_raw_file_descriptor.md)
- [Region](reference/native-apis/_region.md)
- [Rect](reference/native-apis/_rect.md)
- 标准库
- [Node_API](reference/native-lib/third_party_napi/napi.md)
- [libuv](reference/native-lib/third_party_libuv/libuv.md)
......@@ -984,4 +1003,17 @@
- [Native api中导出的EGL符号列表](reference/native-lib/third_party_opengl/egl-symbol.md)
- [Native api中导出的OpenGL ES 3.0符号列表](reference/native-lib/third_party_opengl/openglesv3-symbol.md)
- 常见问题
- [full-SDK替换指南](quick-start/full-sdk-switch-guide.md)
\ No newline at end of file
- [full-SDK替换指南](quick-start/full-sdk-switch-guide.md)
- [Ability框架开发常见问题](faqs/faqs-ability.md)
- [UI框架(JS)开发常见问题](faqs/faqs-ui-js.md)
- [UI框架(eTS)开发常见问题](faqs/faqs-ui-ets.md)
- [图形图像开发常见问题](faqs/faqs-graphics.md)
- [文件管理开发常见问题](faqs/faqs-file-management.md)
- [网络与连接开发常见问题](faqs/faqs-connectivity.md)
- [数据管理开发常见问题](faqs/faqs-data-management.md)
- [设备管理开发常见问题](faqs/faqs-device-management.md)
- [Native API使用常见问题](faqs/faqs-native.md)
- [三四方库使用常见问题](faqs/faqs-third-party-library.md)
- [IDE使用常见问题](faqs/faqs-ide.md)
- [hdc_std命令使用常见问题](faqs/faqs-hdc-std.md)
- [开发板使用常见问题](faqs/faqs-development-board.md)
......@@ -55,54 +55,89 @@
本部分以包管理器的应用权限开发为例进行讲解。开发过程中,首先需要明确涉及的敏感权限,并在config.json中声明该权限,在安装应用程序时,包管理器会调用应用权限管理组件的接口检查该权限是否被授予,若授予,安装流程正常进行,否则安装失败。
1. 在开发过程中,包管理器明确需要安装应用的权限(ohos.permission.INSTALL_BUNDLE),并在config.json中声明该权限;
```
{
...
"module": {
"package": "com.example.kitframework",
"deviceType": [
"phone", "tv","tablet", "pc","car","smartWatch","sportsWatch","smartCamera", "smartVision"
],
"reqPermissions": [{
// 声明需要的权限:安装应用程序的权限名
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}
],
...
}
```
FA模型:需要在config.json中声明权限,示例:
```json
{
"module": {
"package": "ohos.demo.kitframework",
"deviceType": [
"phone", "tv","tablet", "car","smartWatch","sportsWatch","smartCamera", "smartVision"
],
"reqPermissions": [{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}
]
}
}
```
Stage模型:需要在module.json5中声明权限,示例:
```json
{
"module": {
"requestPermissions": [{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}]
}
}
```
2. 当包管理器开发应用安装功能接口时,会调用权限管理相关接口检查自身是否具有安装应用程序的权限,例如:以安装应用的权限名"ohos.permission.INSTALL_BUNDLE"作为入参,调用CheckPermission接口检查包管理器是否具有安装应用的权限,如果有权限,安装流程继续执行,否则返回安装失败;
```
```c++
constexpr static char PERMISSION_INSTALL_BUNDLE[] = "ohos.permission.INSTALL_BUNDLE";
bool Install(const char *hapPath, const InstallParam *installParam, InstallerCallback installerCallback)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册