Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7e40fb45
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7e40fb45
编写于
9月 05, 2023
作者:
L
lixinnan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update api js
Signed-off-by:
N
lixinnan
<
lixinnan1@huawei.com
>
上级
b51e3de0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
93 addition
and
56 deletion
+93
-56
zh-cn/application-dev/reference/apis/js-apis-animator.md
zh-cn/application-dev/reference/apis/js-apis-animator.md
+84
-47
zh-cn/application-dev/reference/apis/js-apis-arkui-componentSnapshot.md
...ion-dev/reference/apis/js-apis-arkui-componentSnapshot.md
+5
-5
zh-cn/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md
...on-dev/reference/apis/js-apis-arkui-drawableDescriptor.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-arkui-inspector.md
...application-dev/reference/apis/js-apis-arkui-inspector.md
+3
-3
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-animator.md
浏览文件 @
7e40fb45
...
...
@@ -14,8 +14,9 @@
## 导入模块
```
js
import
animator
,
{
AnimatorResult
}
from
'
@ohos.animator
'
;
```
ts
import
animator
,
{
AnimatorOptions
,
AnimatorResult
}
from
'
@ohos.animator
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
```
## create<sup>9+</sup>
...
...
@@ -39,10 +40,9 @@ create(options: AnimatorOptions): AnimatorResult
**示例:**
```
js
import
animator
,
{
AnimatorResult
}
from
'
@ohos.animator
'
;
let
options
:
AnimatorOptions
=
{
// xxx.js文件中不需要强调显式类型AnimatorOptions
```
ts
import
animator
,
{
AnimatorOptions
,
AnimatorResult
}
from
'
@ohos.animator
'
;
let
options
:
AnimatorOptions
=
{
duration
:
1500
,
easing
:
"
friction
"
,
delay
:
0
,
...
...
@@ -84,8 +84,10 @@ reset(options: AnimatorOptions): void
**示例:**
```
js
let
options
:
AnimatorOptions
=
{
// xxx.js文件中不需要强调显式类型AnimatorOptions
```
ts
import
animator
,
{
AnimatorOptions
,
AnimatorResult
}
from
'
@ohos.animator
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
:
AnimatorOptions
=
{
duration
:
1500
,
easing
:
"
friction
"
,
delay
:
0
,
...
...
@@ -98,7 +100,9 @@ let options: AnimatorOptions = { // xxx.js文件中不需要强调显式类型An
try
{
animator
.
reset
(
options
);
}
catch
(
error
)
{
console
.
error
(
`Animator reset failed, error code:
${
error
.
code
}
, message:
${
error
.
message
}
.`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`Animator reset failed, error code:
${
code
}
, message:
${
message
}
.`
);
}
```
...
...
@@ -112,7 +116,7 @@ play(): void
**示例:**
```
j
s
```
t
s
animator
.
play
();
```
...
...
@@ -126,7 +130,7 @@ finish(): void
**示例:**
```
j
s
```
t
s
animator
.
finish
();
```
...
...
@@ -140,7 +144,7 @@ pause(): void
**示例:**
```
j
s
```
t
s
animator
.
pause
();
```
...
...
@@ -154,7 +158,7 @@ cancel(): void
**示例:**
```
j
s
```
t
s
animator
.
cancel
();
```
...
...
@@ -168,7 +172,7 @@ reverse(): void
**示例:**
```
j
s
```
t
s
animator
.
reverse
();
```
...
...
@@ -188,9 +192,10 @@ onframe: (progress: number) => void
**示例:**
```
js
let
animatorResult
=
animator
.
create
(
options
)
animatorResult
.
onframe
=
function
(
value
)
{
```
ts
import
animator
,
{
AnimatorResult
}
from
'
@ohos.animator
'
;
let
animatorResult
:
AnimatorResult
|
undefined
=
animator
.
create
(
options
)
animatorResult
.
onframe
=
(
value
)
=>
{
console
.
info
(
"
onframe callback
"
)
}
```
...
...
@@ -205,9 +210,10 @@ onfinish: () => void
**示例:**
```
js
let
animatorResult
=
animator
.
create
(
options
)
animatorResult
.
onfinish
=
function
()
{
```
ts
import
animator
,
{
AnimatorResult
}
from
'
@ohos.animator
'
;
let
animatorResult
:
AnimatorResult
|
undefined
=
animator
.
create
(
options
)
animatorResult
.
onfinish
=
()
=>
{
console
.
info
(
"
onfinish callback
"
)
}
```
...
...
@@ -222,9 +228,10 @@ oncancel: () => void
**示例:**
```
js
let
animatorResult
=
animator
.
create
(
options
)
animatorResult
.
oncancel
=
function
()
{
```
ts
import
animator
,
{
AnimatorResult
}
from
'
@ohos.animator
'
;
let
animatorResult
:
AnimatorResult
|
undefined
=
animator
.
create
(
options
)
animatorResult
.
oncancel
=
()
=>
{
console
.
info
(
"
oncancel callback
"
)
}
```
...
...
@@ -239,9 +246,10 @@ onrepeat: () => void
**示例:**
```
js
let
animatorResult
=
animator
.
create
(
options
)
animatorResult
.
onrepeat
=
function
()
{
```
ts
import
animator
,
{
AnimatorResult
}
from
'
@ohos.animator
'
;
let
animatorResult
:
AnimatorResult
|
undefined
=
animator
.
create
(
options
)
animatorResult
.
onrepeat
=
()
=>
{
console
.
info
(
"
onrepeat callback
"
)
}
```
...
...
@@ -277,15 +285,28 @@ animatorResult.onrepeat = function() {
</div>
```
```
js
export
default
{
data
:
{
divWidth
:
200
,
divHeight
:
200
,
animator
:
null
},
```
ts
import
animator
,
{
AnimatorOptions
,
AnimatorResult
}
from
'
@ohos.animator
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
DataTmp
:
Record
<
string
,
animator
>
=
{
'
divWidth
'
:
200
,
'
divHeight
'
:
200
,
'
animator
'
:
animator
}
class
Tmp
{
data
:
animator
=
DataTmp
onInit
:
Function
=
()
=>
{}
Show
:
Function
=
()
=>
{}
}
class
DateT
{
divWidth
:
number
=
0
divHeight
:
number
=
0
animator
:
AnimatorResult
|
null
=
null
}
(
Fn
:(
v
:
Tmp
)
=>
void
)
=>
{
Fn
({
data
:
DataTmp
,
onInit
()
{
let
options
=
{
let
options
:
AnimatorOptions
=
{
duration
:
1500
,
easing
:
"
friction
"
,
delay
:
0
,
...
...
@@ -295,10 +316,15 @@ export default {
begin
:
200.0
,
end
:
400.0
};
this
.
animator
=
animator
.
create
(
options
);
let
DataTmp
:
DateT
=
{
divWidth
:
200
,
divHeight
:
200
,
animator
:
null
}
DataTmp
.
animator
=
animator
.
create
(
options
);
},
Show
()
{
let
options1
=
{
let
options1
:
AnimatorOptions
=
{
duration
:
1500
,
easing
:
"
friction
"
,
delay
:
0
,
...
...
@@ -308,19 +334,29 @@ export default {
begin
:
0
,
end
:
400.0
,
};
let
DataTmp
:
DateT
=
{
divWidth
:
200
,
divHeight
:
200
,
animator
:
null
}
try
{
this
.
animator
.
reset
(
options1
);
DataTmp
.
animator
=
animator
.
create
(
options1
);
DataTmp
.
animator
.
reset
(
options1
);
}
catch
(
error
)
{
console
.
error
(
`Animator reset failed, error code:
${
error
.
code
}
, message:
${
error
.
message
}
.`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`Animator reset failed, error code:
${
code
}
, message:
${
message
}
.`
);
}
let
_this
=
DataTmp
;
if
(
DataTmp
.
animator
){
DataTmp
.
animator
.
onframe
=
(
value
:
number
)
=>
{
_this
.
divWidth
=
value
;
_this
.
divHeight
=
value
;
};
DataTmp
.
animator
.
play
();
}
let
_this
=
this
;
this
.
animator
.
onframe
=
function
(
value
)
{
_this
.
divWidth
=
value
;
_this
.
divHeight
=
value
;
};
this
.
animator
.
play
();
}
}
}
)}
```
!
[
zh-cn_image_00007
](
figures/zh-cn_image_00007.gif
)
...
...
@@ -501,7 +537,7 @@ update(options: AnimatorOptions): void
**示例:**
```
j
s
```
t
s
animator
.
update
(
options
);
```
...
...
@@ -529,7 +565,8 @@ createAnimator(options: AnimatorOptions): AnimatorResult
**示例:**
```
js
```
ts
import
animator
,
{
AnimatorOptions
,
AnimatorResult
}
from
'
@ohos.animator
'
;
let
options
:
AnimatorOptions
=
{
// xxx.js文件中不需要强调显式类型AnimatorOptions
duration
:
1500
,
easing
:
"
friction
"
,
...
...
zh-cn/application-dev/reference/apis/js-apis-arkui-componentSnapshot.md
浏览文件 @
7e40fb45
...
...
@@ -11,7 +11,7 @@
## 导入模块
```
j
s
```
t
s
import
componentSnapshot
from
"
@ohos.arkui.componentSnapshot
"
;
```
...
...
@@ -42,14 +42,14 @@ get(id: string, callback: AsyncCallback<image.PixelMap>): void
**示例:**
```
j
s
```
t
s
import
componentSnapshot
from
'
@ohos.arkui.componentSnapshot
'
import
image
from
'
@ohos.multimedia.image
'
@
Entry
@
Component
struct
SnapshotExample
{
@
State
pixmap
:
image
.
PixelMap
=
undefined
@
State
pixmap
:
image
.
PixelMap
|
undefined
=
undefined
build
()
{
Column
()
{
...
...
@@ -108,14 +108,14 @@ get(id: string): Promise<image.PixelMap>
**示例:**
```
j
s
```
t
s
import
componentSnapshot
from
'
@ohos.arkui.componentSnapshot
'
import
image
from
'
@ohos.multimedia.image
'
@
Entry
@
Component
struct
SnapshotExample
{
@
State
pixmap
:
image
.
PixelMap
=
undefined
@
State
pixmap
:
image
.
PixelMap
|
undefined
=
undefined
build
()
{
Column
()
{
...
...
zh-cn/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md
浏览文件 @
7e40fb45
...
...
@@ -10,7 +10,7 @@
## 导入模块
```
j
s
```
t
s
import
{
DrawableDescriptor
,
LayeredDrawableDescriptor
}
from
'
@ohos.arkui.drawableDescriptor
'
;
```
...
...
zh-cn/application-dev/reference/apis/js-apis-arkui-inspector.md
浏览文件 @
7e40fb45
...
...
@@ -10,7 +10,7 @@
## 导入模块
```
j
s
```
t
s
import
inspector
from
'
@ohos.arkui.inspector
'
```
...
...
@@ -36,8 +36,8 @@ createComponentObserver(id: string): ComponentObserver
**示例:**
```
j
s
let
listener
=
inspector
.
createComponentObserver
(
'
COMPONENT_ID
'
);
//监听id为COMPONENT_ID的组件回调事件
```
t
s
let
listener
:
inspector
=
inspector
.
createComponentObserver
(
'
COMPONENT_ID
'
);
//监听id为COMPONENT_ID的组件回调事件
```
## ComponentObserver
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录