Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
87b4b419
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看板
未验证
提交
87b4b419
编写于
8月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!7937 【轻量级 PR】:update zh-cn/application-dev/reference/apis/js-apis-window.md.
Merge pull request !7937 from 葛亚芳/N/A
上级
8b887425
acc300d4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
25 deletion
+25
-25
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+25
-25
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
87b4b419
...
...
@@ -240,13 +240,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>
...
...
@@ -279,7 +280,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
));
});
...
...
@@ -310,11 +311,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
);
});
```
...
...
@@ -350,9 +351,9 @@ 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
));
console
.
info
(
'
Succeeded in creating the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to create the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
});
```
...
...
@@ -377,11 +378,11 @@ find(id: string, callback: AsyncCallback<Window>): void
var
windowClass
=
null
;
window
.
find
(
"
alertWindow
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to find the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to find the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
windowClass
=
data
;
console
.
info
(
'
window found
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in finding the window
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -412,7 +413,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
));
});
...
...
@@ -806,7 +807,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
));
})
```
...
...
@@ -831,7 +832,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
));
})
...
...
@@ -963,7 +964,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
));
});
```
...
...
@@ -994,7 +995,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
));
})
...
...
@@ -1024,7 +1025,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
));
});
```
...
...
@@ -1054,7 +1055,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
));
});
...
...
@@ -2506,7 +2507,7 @@ promise.then((data)=> {
setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback
<
void
>
): void
设置窗口是否为隐私模式,使用callback异步回调。
设置窗口是否为隐私模式,使用callback异步回调。
设置为隐私模式的窗口,窗口内容无法被截屏或录屏。
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
...
...
@@ -2535,7 +2536,7 @@ windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
setPrivacyMode(isPrivacyMode: boolean): Promise
<
void
>
设置窗口是否为隐私模式,使用Promise异步回调。
设置窗口是否为隐私模式,使用Promise异步回调。
设置为隐私模式的窗口,窗口内容无法被截屏或录屏。
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
...
...
@@ -3154,5 +3155,4 @@ class myAbility extends Ability {
windowStage
.
setShowOnLockScreen
(
true
);
}
}
```
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录