Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2108ea0a
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看板
未验证
提交
2108ea0a
编写于
8月 09, 2022
作者:
葛
葛亚芳
提交者:
Gitee
8月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-window.md.
Signed-off-by:
N
ge-yafang
<
geyafang@huawei.com
>
上级
ccd2f913
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
37 deletion
+33
-37
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+33
-37
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
2108ea0a
...
...
@@ -302,13 +302,14 @@ create(id: string, type: WindowType, callback: AsyncCallback<Window>): voi
```
js
var
windowClass
=
null
;
let
promise
=
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
SubWindow created. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
});
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
,(
err
,
data
)
=>
{
if
(
err
.
code
){
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the subWindow. Data:
'
+
JSON
.
stringify
(
data
));
});
```
## window.create<sup>7+</sup>
...
...
@@ -341,7 +342,7 @@ var windowClass = null;
let
promise
=
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Su
bWindow created
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Su
cceeded in creating the subWindow
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -372,11 +373,11 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback<Wi
var
windowClass
=
null
;
window
.
create
(
this
.
context
,
"
alertWindow
"
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to create the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to create the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
windowClass
=
data
;
console
.
info
(
'
Window created
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in creating the window
. Data:
'
+
JSON
.
stringify
(
data
));
windowClass
.
resetSize
(
500
,
1000
);
});
```
...
...
@@ -411,8 +412,8 @@ create(ctx: Context, id: string, type: WindowType): Promise<Window>
var
windowClass
=
null
;
let
promise
=
window
.
create
(
this
.
context
,
"
alertWindow
"
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Window created
. Data:
'
+
JSON
.
stringify
(
data
));
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the Window. Cause:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -443,7 +444,7 @@ var windowClass = null;
return
;
}
windowClass
=
data
;
console
.
info
(
'
window found
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in finding the window
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -474,7 +475,7 @@ var windowClass = null;
let
promise
=
window
.
find
(
"
alertWindow
"
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
window found
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in finding the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to find the Window. Cause:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -868,7 +869,7 @@ windowClass.hide((err, data) => {
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
window hidden
. data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in hiding the window
. data:
'
+
JSON
.
stringify
(
data
));
})
```
...
...
@@ -893,7 +894,7 @@ hide(): Promise<void>
```
js
let
promise
=
windowClass
.
hide
();
promise
.
then
((
data
)
=>
{
console
.
info
(
'
window hidden
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in hiding the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
...
...
@@ -923,7 +924,7 @@ windowClass.hideWithAnimation((err, data) => {
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
window hidden
with animation. data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in hiding the window
with animation. data:
'
+
JSON
.
stringify
(
data
));
})
```
...
...
@@ -948,7 +949,7 @@ hideWithAnimation(): Promise<void>
```
js
let
promise
=
windowClass
.
hideWithAnimation
();
promise
.
then
((
data
)
=>
{
console
.
info
(
'
window hidden
with animation. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in hiding the window
with animation. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
})
...
...
@@ -1135,7 +1136,7 @@ windowClass.moveTo(300, 300, (err, data)=>{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Window moved
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in moving the window
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -1166,7 +1167,7 @@ moveTo(x: number, y: number): Promise<void>
```
js
let
promise
=
windowClass
.
moveTo
(
300
,
300
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Window moved
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in moving the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
...
...
@@ -1196,7 +1197,7 @@ windowClass.resetSize(500, 1000, (err, data) => {
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Window size changed
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in changing the window size
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -1226,7 +1227,7 @@ resetSize(width: number, height: number): Promise<void>
```
js
let
promise
=
windowClass
.
resetSize
(
500
,
1000
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Window size changed
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in changing the window size
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -2583,7 +2584,7 @@ setWakeUpScreen(wakeUp: boolean): void;
**示例:**
```
t
s
```
j
s
var
wakeUp
=
true
;
windowClass
.
setWakeUpScreen
(
wakeUp
);
```
...
...
@@ -3290,9 +3291,8 @@ opacity(opacity: number): void
**示例:**
```
t
s
```
j
s
windowClass
.
opacity
(
0.5
);
console
.
log
(
'
set window opacity end
'
);
```
### scale<sup>9+</sup>
...
...
@@ -3313,14 +3313,13 @@ scale(scaleOptions: ScaleOptions): void
**示例:**
```
t
s
```
j
s
var
obj
:
window
.
ScaleOptions
;
obj
.
x
=
2.0
;
obj
.
y
=
1.0
;
obj
.
pivotX
=
0.5
;
obj
.
pivotY
=
0.5
;
windowClass
.
scale
(
obj
);
console
.
log
(
'
set window scale end
'
);
```
### rotate<sup>9+</sup>
...
...
@@ -3341,7 +3340,7 @@ rotate(rotateOptions: RotateOptions): void
**示例:**
```
t
s
```
j
s
var
obj
:
window
.
RotateOptions
;
obj
.
x
=
1.0
;
obj
.
y
=
1.0
;
...
...
@@ -3349,7 +3348,6 @@ obj.z = 45.0;
obj
.
pivotX
=
0.5
;
obj
.
pivotY
=
0.5
;
windowClass
.
rotate
(
obj
);
console
.
log
(
'
set window rotate end
'
);
```
### translate<sup>9+</sup>
...
...
@@ -3370,13 +3368,12 @@ translate(translateOptions: TranslateOptions): void
**示例:**
```
t
s
```
j
s
var
obj
:
window
.
TranslateOptions
;
obj
.
x
=
100.0
;
obj
.
y
=
0.0
;
obj
.
z
=
0.0
;
windowClass
.
translate
(
obj
);
console
.
log
(
'
set window translate end
'
);
```
### getTransitionController<sup>9+</sup>
...
...
@@ -3397,7 +3394,7 @@ console.log('set window translate end');
**示例:**
```
t
s
```
j
s
let
controller
=
windowClass
.
getTransitionController
();
// 获取属性转换控制器
controller
.
animationForHidden
=
(
context
:
window
.
TransitionContext
)
=>
{
let
toWindow
=
context
.
toWindow
...
...
@@ -3927,7 +3924,7 @@ completeTransition(isCompleted: boolean): void
**示例:**
```
t
s
```
j
s
let
controller
=
windowClass
.
getTransitionController
();
controller
.
animationForShown
=
(
context
:
window
.
TransitionContext
)
=>
{
let
toWindow
=
context
.
toWindow
...
...
@@ -3974,7 +3971,7 @@ animationForShown(context: TransitionContext): void
**示例:**
```
t
s
```
j
s
let
controller
=
windowClass
.
getTransitionController
();
controller
.
animationForShown
=
(
context
:
window
.
TransitionContext
)
=>
{
let
toWindow
=
context
.
toWindow
...
...
@@ -4015,7 +4012,7 @@ animationForHidden(context: TransitionContext): void
**示例:**
```
t
s
```
j
s
let
controller
=
windowClass
.
getTransitionController
();
controller
.
animationForHidden
=
(
context
:
window
.
TransitionContext
)
=>
{
let
toWindow
=
context
.
toWindow
...
...
@@ -4038,5 +4035,4 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context
.
completeTransition
(
true
)
console
.
info
(
'
complete transition end
'
);
}
```
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录