Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
fee7b202
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看板
未验证
提交
fee7b202
编写于
9月 04, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 04, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23746 窗口ts示例代码 arkts 告警修复
Merge pull request !23746 from lixia/master
上级
4a21e338
b7b6fe61
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
292 addition
and
218 deletion
+292
-218
zh-cn/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md
...erence/apis/js-apis-application-windowExtensionAbility.md
+17
-11
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+275
-207
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md
浏览文件 @
fee7b202
...
...
@@ -41,12 +41,13 @@ onConnect(want: Want): void
**示例:**
```
ts
export
default
class
MyWindowExtensionAbility
extends
WindowExtensionAbility
{
import
WindowExtensionAbility
from
'
@ohos.application.WindowExtensionAbility
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
onConnect
(
want
)
{
export
default
class
MyWindowExtensionAbility
extends
WindowExtensionAbility
{
onConnect
(
want
:
Want
)
{
console
.
info
(
'
WindowExtAbility onConnect, abilityName: ${want.abilityName}
'
);
}
}
```
...
...
@@ -68,12 +69,13 @@ onDisconnect(want: Want): void
**示例:**
```
ts
export
default
class
MyWindowExtensionAbility
extends
WindowExtensionAbility
{
import
WindowExtensionAbility
from
'
@ohos.application.WindowExtensionAbility
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
onDisconnect
(
want
)
{
export
default
class
MyWindowExtensionAbility
extends
WindowExtensionAbility
{
onDisconnect
(
want
:
Want
)
{
console
.
info
(
'
WindowExtAbility onDisconnect, abilityName: ${want.abilityName}
'
);
}
}
```
...
...
@@ -95,16 +97,20 @@ onWindowReady(window: window.Window): void
**示例:**
```
ts
import
WindowExtensionAbility
from
'
@ohos.application.WindowExtensionAbility
'
;
import
window
from
'
@ohos.window
'
;
let
windowStage
:
window
.
WindowStage
|
null
=
null
export
default
class
MyWindowExtensionAbility
extends
WindowExtensionAbility
{
onWindowReady
(
windowClass
:
window
.
Window
)
{
onWindowReady
(
window
)
{
window
.
loadContent
(
'
WindowExtAbility/pages/index1
'
).
then
(()
=>
{
window
.
getProperties
().
then
((
pro
)
=>
{
windowStage
!
.
loadContent
(
'
WindowExtAbility/pages/index1
'
).
then
(()
=>
{
windowClass
.
getProperties
().
then
((
pro
:
window
.
WindowProperties
)
=>
{
console
.
log
(
'
WindowExtension pro: ${JSON.stringify(pro)}
'
);
});
window
.
show
();
window
Class
.
show
();
});
}
}
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
fee7b202
...
...
@@ -2652,27 +2652,33 @@ getUIContext(): UIContext
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
UIContext
}
from
'
@ohos.arkui.UIContext
'
;
export
default
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
windowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
)
{
// 为主窗口加载对应的目标页面。
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
:
BusinessError
)
=>
{
let
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content.
'
);
// 获取应用主窗口。
let
windowClass
=
null
;
windowStage
.
getMainWindow
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
let
windowClass
:
window
.
Window
|
null
=
null
;
windowStage
.
getMainWindow
((
err
:
BusinessError
,
data
)
=>
{
let
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
windowClass
=
data
;
console
.
info
(
'
Succeeded in obtaining the main window. Data:
'
+
JSON
.
stringify
(
data
));
// 获取UIContext实例。
globalThis
.
uiContext
=
windowClass
.
getUIContext
();
let
uiContext
:
UIContext
|
null
=
null
;
uiContext
=
windowClass
.
getUIContext
();
})
});
}
...
...
@@ -2793,20 +2799,37 @@ loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void
**示例:**
```
ts
let
storage
=
new
LocalStorage
();
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
try
{
windowClass
.
loadContent
(
'
pages/page2
'
,
storage
,
(
err
)
=>
{
if
(
err
.
code
)
{
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
:
window
.
Window
|
null
=
null
;
let
storage
:
LocalStorage
=
new
LocalStorage
();
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
try
{
if
(
!
windowClass
)
{
console
.
info
(
'
Failed to load the content. Cause: windowClass is null
'
);
}
else
{
(
windowClass
as
window
.
Window
).
loadContent
(
'
pages/page2
'
,
storage
,
(
err
:
BusinessError
)
=>
{
const
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content.
'
);
});
}
catch
(
exception
)
{
}
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
}
}
}
};
```
### loadContent<sup>9+</sup>
...
...
@@ -2844,19 +2867,35 @@ loadContent(path: string, storage: LocalStorage): Promise<void>
**示例:**
```
ts
let
storage
=
new
LocalStorage
();
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
try
{
let
promise
=
windowClass
.
loadContent
(
'
pages/page2
'
,
storage
);
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
:
window
.
Window
|
null
=
null
;
let
storage
:
LocalStorage
=
new
LocalStorage
();
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
try
{
if
(
!
windowClass
)
{
console
.
info
(
'
Failed to load the content. Cause: windowClass is null
'
);
}
else
{
let
promise
=
(
windowClass
as
window
.
Window
).
loadContent
(
'
pages/page2
'
,
storage
);
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in loading the content.
'
);
}).
catch
((
er
r
)
=>
{
}).
catch
((
err
:
BusinessErro
r
)
=>
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
}
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
}
}
}
};
```
### isWindowShowing<sup>9+</sup>
...
...
@@ -6893,15 +6932,18 @@ getMainWindow(callback: AsyncCallback<Window>): void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
windowStage
.
getMainWindow
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
let
windowClass
:
window
.
Window
|
null
=
null
;
windowStage
.
getMainWindow
((
err
:
BusinessError
,
data
)
=>
{
const
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -6941,18 +6983,20 @@ getMainWindow(): Promise<Window>
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
windowClass
:
window
.
Window
|
null
=
null
;
let
promise
=
windowStage
.
getMainWindow
();
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in obtaining the main window. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
er
r
)
=>
{
}).
catch
((
err
:
BusinessErro
r
)
=>
{
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
...
...
@@ -6988,17 +7032,18 @@ getMainWindowSync(): Window
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
try
{
let
windowClass
=
windowStage
.
getMainWindowSync
();
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7033,16 +7078,19 @@ createSubWindow(name: string, callback: AsyncCallback<Window>): void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
windowClass
:
window
.
Window
|
null
=
null
;
try
{
windowStage
.
createSubWindow
(
'
mySubWindow
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
windowStage
.
createSubWindow
(
'
mySubWindow
'
,
(
err
:
BusinessError
,
data
)
=>
{
const
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -7052,7 +7100,7 @@ export default class EntryAbility extends UIAbility {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7091,24 +7139,26 @@ createSubWindow(name: string): Promise<Window>
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
windowClass
:
window
.
Window
|
null
=
null
;
try
{
let
promise
=
windowStage
.
createSubWindow
(
'
mySubWindow
'
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the subwindow. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
er
r
)
=>
{
}).
catch
((
err
:
BusinessErro
r
)
=>
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7141,15 +7191,18 @@ getSubWindow(callback: AsyncCallback<Array<Window>>): void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
windowStage
.
getSubWindow
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
let
windowClass
:
window
.
Window
[]
=
[];
windowStage
.
getSubWindow
((
err
:
BusinessError
,
data
)
=>
{
const
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to obtain the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -7187,18 +7240,20 @@ getSubWindow(): Promise<Array<Window>>
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
windowClass
:
window
.
Window
[]
=
[]
;
let
promise
=
windowStage
.
getSubWindow
();
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in obtaining the subwindow. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
er
r
)
=>
{
}).
catch
((
err
:
BusinessErro
r
)
=>
{
console
.
error
(
'
Failed to obtain the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
})
}
...
...
@@ -7235,18 +7290,21 @@ loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
storage
:
LocalStorage
=
new
LocalStorage
();
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
)
{
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
try
{
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
)
=>
{
if
(
err
.
code
)
{
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,
(
err
:
BusinessError
)
=>
{
const
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -7254,7 +7312,7 @@ export default class EntryAbility extends UIAbility {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7295,25 +7353,28 @@ loadContent(path: string, storage?: LocalStorage): Promise<void>
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
storage
:
LocalStorage
=
new
LocalStorage
();
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
)
{
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
try
{
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in loading the content.
'
);
}).
catch
((
er
r
)
=>
{
}).
catch
((
err
:
BusinessErro
r
)
=>
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
;
}
};
```
...
...
@@ -7348,15 +7409,18 @@ loadContent(path: string, callback: AsyncCallback<void>): void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
try
{
windowStage
.
loadContent
(
'
pages/page2
'
,
(
err
)
=>
{
if
(
err
.
code
)
{
windowStage
.
loadContent
(
'
pages/page2
'
,
(
err
:
BusinessError
)
=>
{
const
errCode
:
number
=
err
.
code
;
if
(
errCode
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -7364,7 +7428,7 @@ export default class EntryAbility extends UIAbility {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7399,11 +7463,12 @@ on(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
try
{
windowStage
.
on
(
'
windowStageEvent
'
,
(
data
)
=>
{
...
...
@@ -7413,7 +7478,7 @@ export default class EntryAbility extends UIAbility {
}
catch
(
exception
)
{
console
.
error
(
'
Failed to enable the listener for window stage event changes. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7448,18 +7513,19 @@ off(eventType: 'windowStageEvent', callback?: Callback<WindowStageEventType&g
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
try
{
windowStage
.
off
(
'
windowStageEvent
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to disable the listener for window stage event changes. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
@@ -7489,11 +7555,12 @@ disableWindowDecor(): void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
disableWindowDecor
'
);
windowStage
.
disableWindowDecor
();
}
...
...
@@ -7531,17 +7598,18 @@ setShowOnLockScreen(showOnLockScreen: boolean): void
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
w
indowStage
)
{
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
try
{
windowStage
.
setShowOnLockScreen
(
true
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to show on lockscreen. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
};
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录