Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f0139bed
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看板
未验证
提交
f0139bed
编写于
9月 26, 2022
作者:
葛
葛亚芳
提交者:
Gitee
9月 26, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-window.md.
Signed-off-by:
N
葛亚芳
<
geyafang@huawei.com
>
上级
edd52ed2
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
84 addition
and
84 deletion
+84
-84
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+84
-84
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
f0139bed
...
...
@@ -303,8 +303,8 @@ create(id: string, type: WindowType, callback: AsyncCallback<Window>): voi
**示例:**
```
js
var
windowClass
=
null
;
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
,(
err
,
data
)
=>
{
let
windowClass
=
null
;
window
.
create
(
'
first
'
,
window
.
WindowType
.
TYPE_APP
,(
err
,
data
)
=>
{
if
(
err
.
code
){
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -340,8 +340,8 @@ create(id: string, type: WindowType): Promise<Window>
**示例:**
```
js
var
windowClass
=
null
;
let
promise
=
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
);
let
windowClass
=
null
;
let
promise
=
window
.
create
(
'
first
'
,
window
.
WindowType
.
TYPE_APP
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the subWindow. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -372,8 +372,8 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback<Wi
**示例:**
```
js
var
windowClass
=
null
;
window
.
create
(
this
.
context
,
"
alertWindow
"
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
,
(
err
,
data
)
=>
{
let
windowClass
=
null
;
window
.
create
(
this
.
context
,
'
alertWindow
'
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to create the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -411,8 +411,8 @@ create(ctx: Context, id: string, type: WindowType): Promise<Window>
**示例:**
```
js
var
windowClass
=
null
;
let
promise
=
window
.
create
(
this
.
context
,
"
alertWindow
"
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
);
let
windowClass
=
null
;
let
promise
=
window
.
create
(
this
.
context
,
'
alertWindow
'
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the window. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -439,8 +439,8 @@ find(id: string, callback: AsyncCallback<Window>): void
**示例:**
```
js
var
windowClass
=
null
;
window
.
find
(
"
alertWindow
"
,
(
err
,
data
)
=>
{
let
windowClass
=
null
;
window
.
find
(
'
alertWindow
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to find the Window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -473,8 +473,8 @@ find(id: string): Promise<Window>
**示例:**
```
js
var
windowClass
=
null
;
let
promise
=
window
.
find
(
"
alertWindow
"
);
let
windowClass
=
null
;
let
promise
=
window
.
find
(
'
alertWindow
'
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in finding the window. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -502,7 +502,7 @@ getTopWindow(callback: AsyncCallback<Window>): void
**示例:**
```
js
var
windowClass
=
null
;
let
windowClass
=
null
;
window
.
getTopWindow
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -532,7 +532,7 @@ getTopWindow(): Promise<Window>
**示例:**
```
js
var
windowClass
=
null
;
let
windowClass
=
null
;
let
promise
=
window
.
getTopWindow
();
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
...
...
@@ -560,7 +560,7 @@ getTopWindow(ctx: Context, callback: AsyncCallback<Window>): void
**示例:**
```
js
var
windowClass
=
null
;
let
windowClass
=
null
;
window
.
getTopWindow
(
this
.
context
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -594,7 +594,7 @@ getTopWindow(ctx: Context): Promise<Window>
**示例:**
```
js
var
windowClass
=
null
;
let
windowClass
=
null
;
let
promise
=
window
.
getTopWindow
(
this
.
context
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
...
...
@@ -626,7 +626,7 @@ minimizeAll(id: number, callback: AsyncCallback<void>): void
import
display
from
'
@ohos.display
'
import
window
from
'
@ohos.window
'
var
displayClass
=
null
;
let
displayClass
=
null
;
display
.
getDefaultDisplay
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
return
;
...
...
@@ -669,7 +669,7 @@ minimizeAll(id: number): Promise<void>
import
display
from
'
@ohos.display
'
import
window
from
'
@ohos.window
'
var
displayClass
=
null
;
let
displayClass
=
null
;
display
.
getDefaultDisplay
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
return
;
...
...
@@ -1259,7 +1259,7 @@ setWindowType(type: WindowType, callback: AsyncCallback<void>): void
**示例:**
```
js
var
type
=
window
.
WindowType
.
TYPE_APP
;
let
type
=
window
.
WindowType
.
TYPE_APP
;
windowClass
.
setWindowType
(
type
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window type. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1298,7 +1298,7 @@ setWindowType(type: WindowType): Promise<void>
**示例:**
```
js
var
type
=
window
.
WindowType
.
TYPE_APP
;
let
type
=
window
.
WindowType
.
TYPE_APP
;
let
promise
=
windowClass
.
setWindowType
(
type
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the window type. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -1376,7 +1376,7 @@ getAvoidArea(type: [AvoidAreaType](#avoidareatype7), callback: AsyncCallback<
**示例:**
```
js
var
type
=
window
.
AvoidAreaType
.
TYPE_SYSTEM
;
let
type
=
window
.
AvoidAreaType
.
TYPE_SYSTEM
;
windowClass
.
getAvoidArea
(
type
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to obtain the area. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1409,7 +1409,7 @@ getAvoidArea(type: [AvoidAreaType](#avoidareatype7)): Promise<[AvoidArea](#av
**示例:**
```
js
var
type
=
window
.
AvoidAreaType
.
TYPE_SYSTEM
;
let
type
=
window
.
AvoidAreaType
.
TYPE_SYSTEM
;
let
promise
=
windowClass
.
getAvoidArea
(
type
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in obtaining the area. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -1436,7 +1436,7 @@ setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void
**示例:**
```
js
var
isFullScreen
=
true
;
let
isFullScreen
=
true
;
windowClass
.
setFullScreen
(
isFullScreen
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1469,7 +1469,7 @@ setFullScreen(isFullScreen: boolean): Promise<void>
**示例:**
```
js
var
isFullScreen
=
true
;
let
isFullScreen
=
true
;
let
promise
=
windowClass
.
setFullScreen
(
isFullScreen
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in enabling the full-screen mode. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -1496,7 +1496,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void
**示例:**
```
js
var
isLayoutFullScreen
=
true
;
let
isLayoutFullScreen
=
true
;
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1529,7 +1529,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void>
**示例:**
```
js
var
isLayoutFullScreen
=
true
;
let
isLayoutFullScreen
=
true
;
let
promise
=
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -1550,14 +1550,14 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| names | Array | 是 | 设置状态栏和导航栏是否显示。
<br>
例如,需全部显示,该参数设置为[
"status",
"navigation"
];不设置,则默认不显示。 |
| names | Array | 是 | 设置状态栏和导航栏是否显示。
<br>
例如,需全部显示,该参数设置为[
'status',
'navigation'
];不设置,则默认不显示。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。 |
**示例:**
```
js
// 此处以不显示导航栏、状态栏为例
var
names
=
[];
let
names
=
[];
windowClass
.
setSystemBarEnable
(
names
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1579,7 +1579,7 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----- | ---- | ------------------------------------------------------------ |
| names | Array | 是 | 设置状态栏和导航栏是否显示。
<br>
例如,需全部显示,该参数设置为[
"status",
"navigation"
];不设置,则默认不显示。 |
| names | Array | 是 | 设置状态栏和导航栏是否显示。
<br>
例如,需全部显示,该参数设置为[
'status',
'navigation'
];不设置,则默认不显示。 |
**返回值:**
...
...
@@ -1591,7 +1591,7 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>
```
js
// 此处以不显示导航栏、状态栏为例
var
names
=
[];
let
names
=
[];
let
promise
=
windowClass
.
setSystemBarEnable
(
names
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the system bar to be invisible. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -1618,7 +1618,7 @@ setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: Async
**示例:**
```
js
var
SystemBarProperties
=
{
let
SystemBarProperties
=
{
statusBarColor
:
'
#ff00ff
'
,
navigationBarColor
:
'
#00ff00
'
,
//以下两个属性从API Version7开始支持
...
...
@@ -1660,7 +1660,7 @@ setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise<voi
**示例:**
```
js
var
SystemBarProperties
=
{
let
SystemBarProperties
=
{
statusBarColor
:
'
#ff00ff
'
,
navigationBarColor
:
'
#00ff00
'
,
//以下两个属性从API Version7开始支持
...
...
@@ -1696,7 +1696,7 @@ setPreferredOrientation(orientation: Orientation, callback: AsyncCallback<voi
**示例:**
```
js
var
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
let
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
windowClass
.
setPreferredOrientation
(
orientation
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set window orientation. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1729,7 +1729,7 @@ setPreferredOrientation(orientation: Orientation): Promise<void>
**示例:**
```
js
var
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
let
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
let
promise
=
windowClass
.
setPreferredOrientation
(
orientation
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the window orientation. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -1756,7 +1756,7 @@ loadContent(path: string, callback: AsyncCallback<void>): void
**示例:**
```
js
windowClass
.
loadContent
(
"
pages/page2/page2
"
,
(
err
,
data
)
=>
{
windowClass
.
loadContent
(
'
pages/page2/page2
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1788,7 +1788,7 @@ loadContent(path: string): Promise<void>
**示例:**
```
js
let
promise
=
windowClass
.
loadContent
(
"
pages/page2/page2
"
);
let
promise
=
windowClass
.
loadContent
(
'
pages/page2/page2
'
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
...
...
@@ -1820,9 +1820,9 @@ class myAbility extends Ability {
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
"
storageSimpleProp
"
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
"
pages/page2
"
,
this
.
storage
,(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -1863,10 +1863,10 @@ class myAbility extends Ability {
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
"
storageSimpleProp
"
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
promise
=
windowStage
.
loadContent
(
"
pages/page2
"
,
this
.
storage
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -2199,7 +2199,7 @@ off(type: 'screenshot', callback?: Callback<void>): void
**示例:**
```
js
var
callback
=
()
=>
{
let
callback
=
()
=>
{
console
.
info
(
'
screenshot happened
'
);
}
windowClass
.
on
(
'
screenshot
'
,
callback
)
...
...
@@ -2276,7 +2276,7 @@ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>, c
```
js
class
MyDeathRecipient
{
onRemoteDied
()
{
console
.
log
(
"
server died
"
);
console
.
log
(
'
server died
'
);
}
}
class
TestRemoteObject
extends
rpc
.
RemoteObject
{
...
...
@@ -2293,7 +2293,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return
false
;
}
}
let
token
=
new
TestRemoteObject
(
"
testObject
"
);
let
token
=
new
TestRemoteObject
(
'
testObject
'
);
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
console
.
info
(
'
Dialog Window Need Destroy.
'
);
},
(
err
,
data
)
=>
{
...
...
@@ -2333,7 +2333,7 @@ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>):
```
js
class
MyDeathRecipient
{
onRemoteDied
()
{
console
.
log
(
"
server died
"
);
console
.
log
(
'
server died
'
);
}
}
class
TestRemoteObject
extends
rpc
.
RemoteObject
{
...
...
@@ -2350,7 +2350,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return
false
;
}
}
let
token
=
new
TestRemoteObject
(
"
testObject
"
);
let
token
=
new
TestRemoteObject
(
'
testObject
'
);
let
promise
=
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
console
.
info
(
'
Dialog Window Need Destroy.
'
);
});
...
...
@@ -2539,7 +2539,7 @@ setBackgroundColor(color: string, callback: AsyncCallback<void>): void
**示例:**
```
js
var
color
=
'
#00ff33
'
;
let
color
=
'
#00ff33
'
;
windowClass
.
setBackgroundColor
(
color
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -2561,7 +2561,7 @@ setBackgroundColor(color: string): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| color | string | 是 | 需要设置的背景色,为十六进制颜色,不区分大小写,例如
"#00FF00"或"#FF00FF00"
。 |
| color | string | 是 | 需要设置的背景色,为十六进制颜色,不区分大小写,例如
`#00FF00`
或
`#FF00FF00`
。 |
**返回值:**
...
...
@@ -2572,7 +2572,7 @@ setBackgroundColor(color: string): Promise<void>
**示例:**
```
js
var
color
=
'
#00ff33
'
;
let
color
=
'
#00ff33
'
;
let
promise
=
windowClass
.
setBackgroundColor
(
color
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the background color. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -2600,7 +2600,7 @@ setWakeUpScreen(wakeUp: boolean): void;
**示例:**
```
js
var
wakeUp
=
true
;
let
wakeUp
=
true
;
windowClass
.
setWakeUpScreen
(
wakeUp
);
```
...
...
@@ -2622,7 +2622,7 @@ setBrightness(brightness: number, callback: AsyncCallback<void>): void
**示例:**
```
js
var
brightness
=
1
;
let
brightness
=
1
;
windowClass
.
setBrightness
(
brightness
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -2655,7 +2655,7 @@ setBrightness(brightness: number): Promise<void>
**示例:**
```
js
var
brightness
=
1
;
let
brightness
=
1
;
let
promise
=
windowClass
.
setBrightness
(
brightness
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the brightness. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -2748,7 +2748,7 @@ setFocusable(isFocusable: boolean, callback: AsyncCallback<void>): void
**示例:**
```
js
var
isFocusable
=
true
;
let
isFocusable
=
true
;
windowClass
.
setFocusable
(
isFocusable
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -2781,7 +2781,7 @@ setFocusable(isFocusable: boolean): Promise<void>
**示例:**
```
js
var
isFocusable
=
true
;
let
isFocusable
=
true
;
let
promise
=
windowClass
.
setFocusable
(
isFocusable
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the window to be focusable. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -2808,7 +2808,7 @@ setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback<void>): v
**示例:**
```
js
var
isKeepScreenOn
=
true
;
let
isKeepScreenOn
=
true
;
windowClass
.
setKeepScreenOn
(
isKeepScreenOn
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the screen to be always on. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -2841,7 +2841,7 @@ setKeepScreenOn(isKeepScreenOn: boolean): Promise<void>
**示例:**
```
js
var
isKeepScreenOn
=
true
;
let
isKeepScreenOn
=
true
;
let
promise
=
windowClass
.
setKeepScreenOn
(
isKeepScreenOn
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the screen to be always on. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -2934,7 +2934,7 @@ setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): voi
**示例:**
```
js
var
isPrivacyMode
=
true
;
let
isPrivacyMode
=
true
;
windowClass
.
setPrivacyMode
(
isPrivacyMode
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -2968,7 +2968,7 @@ setPrivacyMode(isPrivacyMode: boolean): Promise<void>
**示例:**
```
js
var
isPrivacyMode
=
true
;
let
isPrivacyMode
=
true
;
let
promise
=
windowClass
.
setPrivacyMode
(
isPrivacyMode
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the window to privacy mode. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -2992,7 +2992,7 @@ setSnapshotSkip(isSkip: boolean): void
| ------------- | ------- | ---- | -------------------- |
| isSkip | boolean | 是 | 截屏录屏是否忽略当前窗口,默认为false。
<br>
true表示忽略当前窗口,false表示不忽略当前窗口。
</br>
|
```
js
var
isSkip
=
true
;
let
isSkip
=
true
;
windowClass
.
setSnapshotSkip
(
isSkip
);
```
...
...
@@ -3014,7 +3014,7 @@ setTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void
**示例:**
```
js
var
isTouchable
=
true
;
let
isTouchable
=
true
;
windowClass
.
setTouchable
(
isTouchable
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -3048,7 +3048,7 @@ setTouchable(isTouchable: boolean): Promise<void>
**示例:**
```
js
var
isTouchable
=
true
;
let
isTouchable
=
true
;
let
promise
=
windowClass
.
setTouchable
(
isTouchable
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in setting the window to be touchable. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -3077,7 +3077,7 @@ setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback<void&g
**示例:**
```
js
var
isForbidSplitMove
=
true
;
let
isForbidSplitMove
=
true
;
windowClass
.
setForbidSplitMove
(
isForbidSplitMove
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -3113,7 +3113,7 @@ setForbidSplitMove(isForbidSplitMove: boolean): Promise<void>
**示例:**
```
js
var
isForbidSplitMove
=
true
;
let
isForbidSplitMove
=
true
;
let
promise
=
windowClass
.
setForbidSplitMove
(
isForbidSplitMove
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in forbidding window moving in split screen mode. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -3329,7 +3329,7 @@ scale(scaleOptions: ScaleOptions): void
**示例:**
```
js
var
obj
:
window
.
ScaleOptions
=
{
let
obj
:
window
.
ScaleOptions
=
{
x
:
2.0
,
y
:
1.0
,
pivotX
=
0.5
;
...
...
@@ -3357,7 +3357,7 @@ rotate(rotateOptions: RotateOptions): void
**示例:**
```
js
var
obj
:
window
.
RotateOptions
=
{
let
obj
:
window
.
RotateOptions
=
{
x
:
1.0
,
y
:
1.0
,
z
:
45.0
,
...
...
@@ -3386,7 +3386,7 @@ translate(translateOptions: TranslateOptions): void
**示例:**
```
js
var
obj
:
window
.
TranslateOptions
=
{
let
obj
:
window
.
TranslateOptions
=
{
x
:
100.0
,
y
:
0.0
,
z
:
0.0
...
...
@@ -3427,7 +3427,7 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context
.
completeTransition
(
true
)
}
},
()
=>
{
var
obj
:
window
.
TranslateOptions
=
{
let
obj
:
window
.
TranslateOptions
=
{
x
:
100.0
,
y
:
0.0
,
z
:
0.0
...
...
@@ -3491,7 +3491,7 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
windowClass
=
null
;
windowStage
.
getMainWindow
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -3526,7 +3526,7 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
windowClass
=
null
;
let
promise
=
windowStage
.
getMainWindow
();
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
...
...
@@ -3561,8 +3561,8 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
windowStage
.
createSubWindow
(
"
mySubWindow
"
,
(
err
,
data
)
=>
{
let
windowClass
=
null
;
windowStage
.
createSubWindow
(
'
mySubWindow
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -3603,8 +3603,8 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
promise
=
windowStage
.
createSubWindow
(
"
mySubWindow
"
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
createSubWindow
(
'
mySubWindow
'
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the subwindow. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -3637,7 +3637,7 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
windowClass
=
null
;
windowStage
.
getSubWindow
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to obtain the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -3672,7 +3672,7 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
windowClass
=
null
;
let
promise
=
windowStage
.
getSubWindow
();
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
...
...
@@ -3709,9 +3709,9 @@ class myAbility extends Ability {
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
"
storageSimpleProp
"
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
"
pages/page2
"
,
this
.
storage
,(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -3753,10 +3753,10 @@ class myAbility extends Ability {
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
"
storageSimpleProp
"
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
var
windowClass
=
null
;
let
promise
=
windowStage
.
loadContent
(
"
pages/page2
"
,
this
.
storage
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -3791,7 +3791,7 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/page2
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -3959,7 +3959,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
iterations
:
1
,
// 播放次数
playMode
:
PlayMode
.
Normal
,
// 动画模式
},
()
=>
{
var
obj
:
window
.
TranslateOptions
=
{
let
obj
:
window
.
TranslateOptions
=
{
x
:
100.0
,
y
:
0.0
,
z
:
0.0
...
...
@@ -4010,7 +4010,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
context
.
completeTransition
(
true
)
}
},
()
=>
{
var
obj
:
window
.
TranslateOptions
=
{
let
obj
:
window
.
TranslateOptions
=
{
x
:
100.0
,
y
:
0.0
,
z
:
0.0
...
...
@@ -4056,7 +4056,7 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context
.
completeTransition
(
true
)
}
},
()
=>
{
var
obj
:
window
.
TranslateOptions
=
{
let
obj
:
window
.
TranslateOptions
=
{
x
:
100.0
,
y
:
0.0
,
z
:
0.0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录