未验证 提交 43465083 编写于 作者: O openharmony_ci 提交者: Gitee

!21376 接口一致性与示例代码整改

Merge pull request !21376 from 田雨/amster
...@@ -519,7 +519,7 @@ uiContext.runScopedTask( ...@@ -519,7 +519,7 @@ uiContext.runScopedTask(
### registerFont ### registerFont
registerFont(options: FontOptions): void registerFont(options: font.FontOptions): void
在字体管理中注册自定义字体。 在字体管理中注册自定义字体。
...@@ -594,7 +594,7 @@ font.getFontByName('Sans Italic') ...@@ -594,7 +594,7 @@ font.getFontByName('Sans Italic')
### getRectangleById ### getRectangleById
getRectangleById(id: string): ComponentUtils.ComponentInfo getRectangleById(id: string): componentUtils.ComponentInfo
获取组件大小、位置、平移缩放旋转及仿射矩阵属性信息。 获取组件大小、位置、平移缩放旋转及仿射矩阵属性信息。
...@@ -932,7 +932,7 @@ router.replaceUrl({ ...@@ -932,7 +932,7 @@ router.replaceUrl({
### replaceUrl ### replaceUrl
replaceUrl(options: RouterOptions, callback: AsyncCallback<void>): void replaceUrl(options: router.RouterOptions, callback: AsyncCallback<void>): void
用应用内的某个页面替换当前页面,并销毁被替换的页面。 用应用内的某个页面替换当前页面,并销毁被替换的页面。
...@@ -1213,7 +1213,7 @@ router.pushNamedRoute({ ...@@ -1213,7 +1213,7 @@ router.pushNamedRoute({
### pushNamedRoute ### pushNamedRoute
pushNamedRoute(options: NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void pushNamedRoute(options: router.NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void
跳转到指定的命名路由页面。 跳转到指定的命名路由页面。
...@@ -1375,7 +1375,7 @@ replaceNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode): ...@@ -1375,7 +1375,7 @@ replaceNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode):
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| --------- | ------- | | --------- | ------- |
| 100001 | if the pages are pushed too much. | | 100001 | if UI execution context not found, only throw in standard system. |
| 100004 | if the named route is not exist. | | 100004 | if the named route is not exist. |
**示例:** **示例:**
...@@ -1398,7 +1398,7 @@ router.replaceNamedRoute({ ...@@ -1398,7 +1398,7 @@ router.replaceNamedRoute({
### replaceNamedRoute ### replaceNamedRoute
replaceNamedRoute(options: NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void replaceNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode, callback: AsyncCallback<void>): void
用指定的命名路由页面替换当前页面,并销毁被替换的页面。 用指定的命名路由页面替换当前页面,并销毁被替换的页面。
...@@ -1441,7 +1441,7 @@ router.replaceNamedRoute({ ...@@ -1441,7 +1441,7 @@ router.replaceNamedRoute({
### back ### back
back(options?: router.RouterOptions ): void back(options: router.RouterOptions ): void
返回上一页面或指定的页面。 返回上一页面或指定的页面。
...@@ -1451,7 +1451,7 @@ back(options?: router.RouterOptions ): void ...@@ -1451,7 +1451,7 @@ back(options?: router.RouterOptions ): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [router.RouterOptions](js-apis-router.md#routeroptions) | | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页,页面不会重新构建,页面栈里面的page不会回收,出栈后会被回收。 | | options | [router.RouterOptions](js-apis-router.md#routeroptions) | | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页,页面不会重新构建,页面栈里面的page不会回收,出栈后会被回收。 |
**示例:** **示例:**
...@@ -1634,7 +1634,7 @@ try { ...@@ -1634,7 +1634,7 @@ try {
### showDialog ### showDialog
showDialog(options: promptAction.ShowDialogOptions, callback: AsyncCallback<ShowDialogSuccessResponse<): void showDialog(options: promptAction.ShowDialogOptions, callback: AsyncCallback<promptAction.ShowDialogSuccessResponse<): void
创建并显示对话框,对话框响应结果异步返回。 创建并显示对话框,对话框响应结果异步返回。
...@@ -1745,7 +1745,7 @@ try { ...@@ -1745,7 +1745,7 @@ try {
### showActionMenu ### showActionMenu
showActionMenu(options: promptAction.ActionMenuOptions, callback: AsyncCallback<promptAction.ActionMenuSuccessResponse>):void showActionMenu(options: promptAction.ActionMenuOptions, callback:promptAction.ActionMenuSuccessResponse):void
创建并显示操作菜单,菜单响应结果异步返回。 创建并显示操作菜单,菜单响应结果异步返回。
...@@ -1756,7 +1756,7 @@ showActionMenu(options: promptAction.ActionMenuOptions, callback: AsyncCallback& ...@@ -1756,7 +1756,7 @@ showActionMenu(options: promptAction.ActionMenuOptions, callback: AsyncCallback&
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------ |
| options | [promptAction.ActionMenuOptions](js-apis-promptAction.md#actionmenuoptions) | 是 | 操作菜单选项。 | | options | [promptAction.ActionMenuOptions](js-apis-promptAction.md#actionmenuoptions) | 是 | 操作菜单选项。 |
| callback | AsyncCallback<[promptAction.ActionMenuSuccessResponse](js-apis-promptAction.md#actionmenusuccessresponse)> | 是 | 菜单响应结果回调。 | | callback | [promptAction.ActionMenuSuccessResponse](js-apis-promptAction.md#actionmenusuccessresponse) | 是 | 菜单响应结果回调。 |
**错误码:** **错误码:**
......
...@@ -28,7 +28,7 @@ executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo, callback: ...@@ -28,7 +28,7 @@ executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo, callback:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------------------- |
| custom | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) \| [DragItemInfo](../arkui-ts/ts-universal-events-drag-drop.md#dragiteminfo说明) | 是 | 拖拽发起后跟手效果所拖拽的对象。 | | custom | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) \| [DragItemInfo](../arkui-ts/ts-universal-events-drag-drop.md#dragiteminfo说明) | 是 | 拖拽发起后跟手效果所拖拽的对象。 |
| dragInfo | [DragInfo](#draginfo说明) | 是 | 拖拽信息。 | | dragInfo | [DragInfo](#draginfo) | 是 | 拖拽信息。 |
| callback | AsyncCallback<{event: [DragEvent](../arkui-ts/ts-universal-events-drag-drop.md#dragevent说明), extraParams: string}> | 是 | 拖拽结束返回结果的回调。 | | callback | AsyncCallback<{event: [DragEvent](../arkui-ts/ts-universal-events-drag-drop.md#dragevent说明), extraParams: string}> | 是 | 拖拽结束返回结果的回调。 |
**示例:** **示例:**
...@@ -89,9 +89,9 @@ executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo): Promise&l ...@@ -89,9 +89,9 @@ executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo): Promise&l
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------------------- |
| custom | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) \| [DragItemInfo](../arkui-ts/ts-universal-events-drag-drop.md#dragiteminfo说明) | 是 | 拖拽发起后跟手效果所拖拽的对象。 | | custom | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) \| [DragItemInfo](../arkui-ts/ts-universal-events-drag-drop.md#dragiteminfo说明) | 是 | 拖拽发起后跟手效果所拖拽的对象。 |
| dragInfo | [DragInfo](#draginfo说明) | 是 | 拖拽信息。 | | dragInfo | [DragInfo](#draginfo) | 是 | 拖拽信息。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------------------ | ------------------ | | ------------------------------------------------------ | ------------------ |
...@@ -169,7 +169,9 @@ struct DragControllerPage { ...@@ -169,7 +169,9 @@ struct DragControllerPage {
} }
``` ```
## DragInfo说明 ## DragInfo
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
发起拖拽所需要的属性和拖拽时携带的信息。 发起拖拽所需要的属性和拖拽时携带的信息。
......
...@@ -57,7 +57,7 @@ struct Index { ...@@ -57,7 +57,7 @@ struct Index {
Row() { Row() {
Column() { Column() {
Image((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon').id)))) Image((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon').id))))
Image(((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.drawable') Image(((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getForeground()).getPixelMap()) .id))).getForeground()).getPixelMap())
}.height('50%') }.height('50%')
}.width('50%') }.width('50%')
...@@ -81,7 +81,7 @@ getPixelMap(): image.PixelMap; ...@@ -81,7 +81,7 @@ getPixelMap(): image.PixelMap;
**示例:** **示例:**
```ts ```ts
let resManager = getContext().resourceManager let resManager = getContext().resourceManager
pixmap: PixelMap = (<DrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.icon') let pixmap: PixelMap = (<DrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getPixelMap(); .id))).getPixelMap();
``` ```
...@@ -101,7 +101,7 @@ getPixelMap(): image.PixelMap; ...@@ -101,7 +101,7 @@ getPixelMap(): image.PixelMap;
**示例:** **示例:**
```ts ```ts
let resManager = getContext().resourceManager let resManager = getContext().resourceManager
pixmap: PixelMap = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.drawable') let pixmap: PixelMap = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getPixelMap(); .id))).getPixelMap();
``` ```
...@@ -121,7 +121,7 @@ getForeground(): DrawableDescriptor; ...@@ -121,7 +121,7 @@ getForeground(): DrawableDescriptor;
**示例:** **示例:**
```ts ```ts
let resManager = getContext().resourceManager let resManager = getContext().resourceManager
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.drawable') let drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getForeground(); .id))).getForeground();
``` ```
...@@ -141,7 +141,7 @@ getBackground(): DrawableDescriptor; ...@@ -141,7 +141,7 @@ getBackground(): DrawableDescriptor;
**示例:** **示例:**
```ts ```ts
let resManager = getContext().resourceManager let resManager = getContext().resourceManager
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.drawable') drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getBackground(); .id))).getBackground();
``` ```
...@@ -161,7 +161,7 @@ getMask(): DrawableDescriptor; ...@@ -161,7 +161,7 @@ getMask(): DrawableDescriptor;
**示例:** **示例:**
```ts ```ts
let resManager = getContext().resourceManager let resManager = getContext().resourceManager
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.drawable') let drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getMask(); .id))).getMask();
``` ```
## LayeredDrawableDescriptor.getMashClipPath ## LayeredDrawableDescriptor.getMashClipPath
...@@ -179,7 +179,7 @@ LayeredDrawableDescriptor的静态方法,获取系统内置的裁切路径参 ...@@ -179,7 +179,7 @@ LayeredDrawableDescriptor的静态方法,获取系统内置的裁切路径参
**示例:** **示例:**
```ts ```ts
Image($r('app.media.testImg')) Image($r('app.media.icon'))
.width('200px').height('200px') .width('200px').height('200px')
.clip(new Path({commands:LayeredDrawableDescriptor.getMaskClipPath()})) .clip(new Path({commands:LayeredDrawableDescriptor.getMaskClipPath()}))
``` ```
\ No newline at end of file
...@@ -279,8 +279,8 @@ customCurve(interpolate: (fraction: number) => number): ICurve ...@@ -279,8 +279,8 @@ customCurve(interpolate: (fraction: number) => number): ICurve
```ts ```ts
import Curves from '@ohos.curves' import Curves from '@ohos.curves'
interpolate(fraction) { let interpolate = function(fraction) {
return Math.sqrt(fraction); return Math.sqrt(fraction)
} }
let curve = Curves.customCurve(interpolate) // 创建一个用户自定义插值曲线 let curve = Curves.customCurve(interpolate) // 创建一个用户自定义插值曲线
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册