Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ae00fdfd
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
ae00fdfd
编写于
1月 18, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
!13722 monthly1018分支:context的链接统一修改到BaseContext:需同步翻译
Merge pull request !13722 from 葛亚芳/cherry-pick-1673950203
上级
1f0df4fc
48857c6e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
17 addition
and
21 deletion
+17
-21
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+14
-18
zh-cn/application-dev/windowmanager/application-window-fa.md
zh-cn/application-dev/windowmanager/application-window-fa.md
+3
-3
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
ae00fdfd
...
@@ -54,7 +54,7 @@ import window from '@ohos.window';
...
@@ -54,7 +54,7 @@ import window from '@ohos.window';
| ---------- | -------------------------- | -- | ----------------------------------- |
| ---------- | -------------------------- | -- | ----------------------------------- |
| name | string | 是 | 窗口名字。 |
| name | string | 是 | 窗口名字。 |
| windowType |
[
WindowType
](
#windowtype7
)
| 是 | 窗口类型。 |
| windowType |
[
WindowType
](
#windowtype7
)
| 是 | 窗口类型。 |
| ctx |
BaseContext | 否 | 当前应用上下文信息。
<br>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的Context定义见
[
ServiceExtensionContext
](
js-apis-inner-application-serviceExtensionContext.md
)
。不设置,则默认为空。
<br>
当Context为
[
ServiceExtensionContext
](
js-apis-inner-application-serviceExtensionContext.md
)
时,
创建系统窗口。 |
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 否 | 当前应用上下文信息。不设置,则默认为空。
<br>
FA模型下不需要使用该参数,即可创建子窗口。
<br>
Stage模型下需要使用该参数,用于
创建系统窗口。 |
| displayId | number | 否 | 当前物理屏幕id。不设置,则默认为-1。 |
| displayId | number | 否 | 当前物理屏幕id。不设置,则默认为-1。 |
| parentId | number | 否 | 父窗口id。不设置,则默认为-1。 |
| parentId | number | 否 | 父窗口id。不设置,则默认为-1。 |
...
@@ -430,7 +430,7 @@ getLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void
...
@@ -430,7 +430,7 @@ getLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | -- | ---------------------------------------- |
| -------- | -------------------------------------- | -- | ---------------------------------------- |
| ctx |
BaseContext | 是 | 当前应用上下文信息。
<br>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 是 | 当前应用上下文信息
。 |
| callback | AsyncCallback
<
[Window](#window)
>
| 是 | 回调函数。返回当前应用内最后显示的窗口对象。 |
| callback | AsyncCallback
<
[Window](#window)
>
| 是 | 回调函数。返回当前应用内最后显示的窗口对象。 |
**错误码:**
**错误码:**
...
@@ -472,7 +472,7 @@ getLastWindow(ctx: BaseContext): Promise<Window>
...
@@ -472,7 +472,7 @@ getLastWindow(ctx: BaseContext): Promise<Window>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ------------------------------------------------------------ |
| ------ | ----------- | ---- | ------------------------------------------------------------ |
| ctx |
BaseContext | 是 | 当前应用上下文信息。
<br/>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br/>
Stage模型的Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 是 | 当前应用上下文信息
。 |
**返回值:**
**返回值:**
...
@@ -897,9 +897,7 @@ promise.then((data)=> {
...
@@ -897,9 +897,7 @@ promise.then((data)=> {
create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback
<
Window
>
): void
create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback
<
Window
>
): void
创建子窗口,使用callback异步回调,其中Context详见
[
Context
](
js-apis-inner-app-context.md
)
。
创建系统窗口,使用callback异步回调。
从API version 9开始,当Context为
[
ServiceExtensionContext
](
js-apis-inner-application-serviceExtensionContext.md
)
时,创建系统窗口,使用callback异步回调。
> **说明:**
> **说明:**
>
>
...
@@ -910,8 +908,8 @@ create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback&l
...
@@ -910,8 +908,8 @@ create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback&l
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------
| ---- | ------------------------
------------------------------------ |
| -------- | --------------------------------------
----------------- | ---- |
------------------------------------ |
| ctx |
BaseContext | 是 | 当前应用上下文信息。
<br>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的Context定义见
[
ServiceExtensionContext
](
js-apis-inner-application-serviceExtensionContext.md
)
。
|
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 是 | 当前应用上下文信息。
|
| id | string | 是 | 窗口id。 |
| id | string | 是 | 窗口id。 |
| type |
[
WindowType
](
#windowtype7
)
| 是 | 窗口类型。 |
| type |
[
WindowType
](
#windowtype7
)
| 是 | 窗口类型。 |
| callback | AsyncCallback
<
[Window](#window)
>
| 是 | 回调函数。返回当前创建的子窗口对象。 |
| callback | AsyncCallback
<
[Window](#window)
>
| 是 | 回调函数。返回当前创建的子窗口对象。 |
...
@@ -935,9 +933,7 @@ window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT,
...
@@ -935,9 +933,7 @@ window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT,
create(ctx: BaseContext, id: string, type: WindowType): Promise
<
Window
>
create(ctx: BaseContext, id: string, type: WindowType): Promise
<
Window
>
创建子窗口,使用Promise异步回调,其中Context详见
[
Context
](
js-apis-inner-app-context.md
)
。
创建系统窗口,使用Promise异步回调。
从API version 9开始,当Context为
[
ServiceExtensionContext
](
js-apis-inner-application-serviceExtensionContext.md
)
时,创建系统窗口,使用Promise异步回调。
> **说明:**
> **说明:**
>
>
...
@@ -949,7 +945,7 @@ create(ctx: BaseContext, id: string, type: WindowType): Promise<Window>
...
@@ -949,7 +945,7 @@ create(ctx: BaseContext, id: string, type: WindowType): Promise<Window>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------- | ---- | ------------------------------------------------------------ |
| ------ | ------------------------- | ---- | ------------------------------------------------------------ |
| ctx |
BaseContext | 是 | 当前应用上下文信息。
<br/>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br/>
Stage模型的Context定义见
[
ServiceExtensionContext
](
js-apis-inner-application-serviceExtensionContext.md
)
。 |
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 是 | 当前应用上下文信息
。 |
| id | string | 是 | 窗口id。 |
| id | string | 是 | 窗口id。 |
| type |
[
WindowType
](
#windowtype7
)
| 是 | 窗口类型。 |
| type |
[
WindowType
](
#windowtype7
)
| 是 | 窗口类型。 |
...
@@ -1125,7 +1121,7 @@ getTopWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void
...
@@ -1125,7 +1121,7 @@ getTopWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx |
BaseContext | 是 | 当前应用上下文信息。
<br>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 是 | 当前应用上下文信息
。 |
| callback | AsyncCallback
<
[Window](#window)
>
| 是 | 回调函数。返回当前应用内最后显示的窗口对象。 |
| callback | AsyncCallback
<
[Window](#window)
>
| 是 | 回调函数。返回当前应用内最后显示的窗口对象。 |
**示例:**
**示例:**
...
@@ -1158,7 +1154,7 @@ getTopWindow(ctx: BaseContext): Promise<Window>
...
@@ -1158,7 +1154,7 @@ getTopWindow(ctx: BaseContext): Promise<Window>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ------------------------------------------------------------ |
| ------ | ----------- | ---- | ------------------------------------------------------------ |
| ctx |
BaseContext | 是 | 当前应用上下文信息。
<br/>
FA模型的Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br/>
Stage模型的Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| ctx |
[
BaseContext
](
js-apis-inner-application-baseContext.md
)
| 是 | 当前应用上下文信息
。 |
**返回值:**
**返回值:**
...
...
zh-cn/application-dev/windowmanager/application-window-fa.md
浏览文件 @
ae00fdfd
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
let
windowClass
=
null
;
let
windowClass
=
null
;
// 方式一:创建子窗口。
// 方式一:创建子窗口。
let
config
=
{
name
:
"
subWindow
"
,
windowType
:
window
.
WindowType
.
TYPE_APP
,
ctx
:
this
.
context
};
let
config
=
{
name
:
"
subWindow
"
,
windowType
:
window
.
WindowType
.
TYPE_APP
};
window
.
createWindow
(
config
,
(
err
,
data
)
=>
{
window
.
createWindow
(
config
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
console
.
info
(
'
Succeeded in finding subWindow. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in finding subWindow. Data:
'
+
JSON
.
stringify
(
data
));
windowClass
=
data
;
windowClass
=
data
;
});
});
```
```
2.
设置子窗口属性。
2.
设置子窗口属性。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录