Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
b60efb58
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
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看板
提交
b60efb58
编写于
8月 22, 2023
作者:
S
sqwlly
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'monthly_20230815' of gitee.com:openharmony/docs into monthly_20230815
上级
b5d35767
b5aedf06
变更
38
展开全部
隐藏空白更改
内联
并排
Showing
38 changed file
with
3812 addition
and
1494 deletion
+3812
-1494
en/application-dev/quick-start/introduction-to-arkts.md
en/application-dev/quick-start/introduction-to-arkts.md
+319
-184
en/application-dev/quick-start/typescript-to-arkts-migration-guide.md
...on-dev/quick-start/typescript-to-arkts-migration-guide.md
+679
-644
zh-cn/application-dev/media/Readme-CN.md
zh-cn/application-dev/media/Readme-CN.md
+1
-0
zh-cn/application-dev/media/camera-mode.md
zh-cn/application-dev/media/camera-mode.md
+258
-0
zh-cn/application-dev/media/figures/portrait-capture-development-process.png
...ev/media/figures/portrait-capture-development-process.png
+0
-0
zh-cn/application-dev/quick-start/Readme-CN.md
zh-cn/application-dev/quick-start/Readme-CN.md
+0
-3
zh-cn/application-dev/quick-start/arkts-create-custom-components.md
...ication-dev/quick-start/arkts-create-custom-components.md
+2
-2
zh-cn/application-dev/quick-start/arkts-localstorage.md
zh-cn/application-dev/quick-start/arkts-localstorage.md
+2
-2
zh-cn/application-dev/quick-start/arkts-observed-and-objectlink.md
...lication-dev/quick-start/arkts-observed-and-objectlink.md
+50
-26
zh-cn/application-dev/quick-start/arkts-prop.md
zh-cn/application-dev/quick-start/arkts-prop.md
+88
-25
zh-cn/application-dev/quick-start/arkts-provide-and-consume.md
.../application-dev/quick-start/arkts-provide-and-consume.md
+1
-1
zh-cn/application-dev/quick-start/arkts-state-management-best-practices.md
...-dev/quick-start/arkts-state-management-best-practices.md
+341
-0
zh-cn/application-dev/quick-start/arkts-state.md
zh-cn/application-dev/quick-start/arkts-state.md
+1
-1
zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001653986573.png
...-dev/quick-start/figures/zh-cn_image_0000001653986573.png
+0
-0
zh-cn/application-dev/quick-start/har-package.md
zh-cn/application-dev/quick-start/har-package.md
+43
-41
zh-cn/application-dev/quick-start/introduction-to-arkts.md
zh-cn/application-dev/quick-start/introduction-to-arkts.md
+36
-17
zh-cn/application-dev/quick-start/start-with-ets-stage.md
zh-cn/application-dev/quick-start/start-with-ets-stage.md
+0
-2
zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
...on-dev/quick-start/typescript-to-arkts-migration-guide.md
+484
-466
zh-cn/application-dev/reference/apis/js-apis-audio.md
zh-cn/application-dev/reference/apis/js-apis-audio.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-camera.md
zh-cn/application-dev/reference/apis/js-apis-camera.md
+450
-0
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+100
-45
zh-cn/application-dev/reference/apis/js-apis-installer.md
zh-cn/application-dev/reference/apis/js-apis-installer.md
+11
-15
zh-cn/application-dev/reference/apis/js-apis-net-connection.md
.../application-dev/reference/apis/js-apis-net-connection.md
+13
-2
zh-cn/application-dev/reference/arkui-ts/Readme-CN.md
zh-cn/application-dev/reference/arkui-ts/Readme-CN.md
+1
-1
zh-cn/application-dev/reference/arkui-ts/figures/tabContent5.gif
...pplication-dev/reference/arkui-ts/figures/tabContent5.gif
+0
-0
zh-cn/application-dev/reference/arkui-ts/figures/tabs6.gif
zh-cn/application-dev/reference/arkui-ts/figures/tabs6.gif
+0
-0
zh-cn/application-dev/reference/arkui-ts/figures/tabs7.gif
zh-cn/application-dev/reference/arkui-ts/figures/tabs7.gif
+0
-0
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md
...cation-dev/reference/arkui-ts/ts-basic-components-span.md
+1
-1
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-xcomponent.md
...-dev/reference/arkui-ts/ts-basic-components-xcomponent.md
+5
-5
zh-cn/application-dev/reference/arkui-ts/ts-container-ability-component.md
...-dev/reference/arkui-ts/ts-container-ability-component.md
+2
-0
zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md
...plication-dev/reference/arkui-ts/ts-container-listitem.md
+1
-1
zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md
...ication-dev/reference/arkui-ts/ts-container-tabcontent.md
+130
-2
zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
...n/application-dev/reference/arkui-ts/ts-container-tabs.md
+194
-2
zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md
...n-dev/reference/arkui-ts/ts-custom-component-lifecycle.md
+5
-5
zh-cn/application-dev/reference/errorcodes/Readme-CN.md
zh-cn/application-dev/reference/errorcodes/Readme-CN.md
+1
-0
zh-cn/application-dev/reference/errorcodes/errorcode-image.md
...n/application-dev/reference/errorcodes/errorcode-image.md
+464
-0
zh-cn/application-dev/website.md
zh-cn/application-dev/website.md
+1
-0
zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.3/changelogs-distributeddatamgr.md
...ogs/OpenHarmony_4.0.10.3/changelogs-distributeddatamgr.md
+127
-0
未找到文件。
en/application-dev/quick-start/introduction-to-arkts.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
en/application-dev/quick-start/typescript-to-arkts-migration-guide.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/application-dev/media/Readme-CN.md
浏览文件 @
b60efb58
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
-
相机最佳实践
-
相机最佳实践
-
[
拍照实现方案
](
camera-shooting-case.md
)
-
[
拍照实现方案
](
camera-shooting-case.md
)
-
[
录像实现方案
](
camera-recording-case.md
)
-
[
录像实现方案
](
camera-recording-case.md
)
-
[
人像模式拍照实现方案
](
camera-mode.md
)
-
[
性能提升方案(仅对系统应用开放)
](
camera-performance-improvement.md
)
-
[
性能提升方案(仅对系统应用开放)
](
camera-performance-improvement.md
)
-
图片
-
图片
-
[
图片开发概述
](
image-overview.md
)
-
[
图片开发概述
](
image-overview.md
)
...
...
zh-cn/application-dev/media/camera-mode.md
0 → 100644
浏览文件 @
b60efb58
# 人像模式拍照实现方案
## 开发流程
人像模式依赖于模式化管理器,在获取到模式化管理的能力后,开始创建拍照流
模式化管理是对于cameraManager功能的增强与扩充,主要用于一些高级功能的管理,开发流程如下

## 完整示例
```
ts
import
camera
from
'
@ohos.multimedia.camera
'
import
image
from
'
@ohos.multimedia.image
'
import
media
from
'
@ohos.multimedia.media
'
// 创建CameraManager对象
context
:
any
=
getContext
(
this
)
let
cameraManager
=
camera
.
getCameraManager
(
this
.
context
)
if
(
!
cameraManager
)
{
console
.
error
(
"
camera.getCameraManager error
"
)
return
;
}
// 创建ModeManager对象
context
:
any
=
getContext
(
this
)
let
modeManager
=
camera
.
getModeManager
(
this
.
context
)
if
(
!
cameraManager
)
{
console
.
error
(
"
camera.getModeManager error
"
)
return
;
}
// 监听相机状态变化
cameraManager
.
on
(
'
cameraStatus
'
,
(
err
,
cameraStatusInfo
)
=>
{
console
.
info
(
`camera :
${
cameraStatusInfo
.
camera
.
cameraId
}
`
);
console
.
info
(
`status:
${
cameraStatusInfo
.
status
}
`
);
})
// 获取相机列表
let
cameraArray
=
cameraManager
.
getSupportedCameras
();
if
(
cameraArray
.
length
<=
0
)
{
console
.
error
(
"
cameraManager.getSupportedCameras error
"
)
return
;
}
for
(
let
index
=
0
;
index
<
cameraArray
.
length
;
index
++
)
{
console
.
info
(
'
cameraId :
'
+
cameraArray
[
index
].
cameraId
);
// 获取相机ID
console
.
info
(
'
cameraPosition :
'
+
cameraArray
[
index
].
cameraPosition
);
// 获取相机位置
console
.
info
(
'
cameraType :
'
+
cameraArray
[
index
].
cameraType
);
// 获取相机类型
console
.
info
(
'
connectionType :
'
+
cameraArray
[
index
].
connectionType
);
// 获取相机连接类型
}
// 获取模式列表
let
cameraModeArray
=
modeManager
.
getSupportedModes
(
cameraArray
[
0
]);
if
(
cameraModeArray
.
length
<=
0
)
{
console
.
error
(
"
modeManager.getSupportedModes error
"
)
return
;
}
// 创建相机输入流
let
cameraInput
try
{
cameraInput
=
cameraManager
.
createCameraInput
(
cameraArray
[
0
]);
}
catch
(
error
)
{
console
.
error
(
'
Failed to createCameraInput errorCode =
'
+
error
.
code
);
}
// 监听cameraInput错误信息
let
cameraDevice
=
cameraArray
[
0
];
cameraInput
.
on
(
'
error
'
,
cameraDevice
,
(
error
)
=>
{
console
.
info
(
`Camera input error code:
${
error
.
code
}
`
);
})
// 打开相机
await
cameraInput
.
open
();
// 获取当前模式相机设备支持的输出流能力
let
cameraOutputCap
=
modeManager
.
getSupportedOutputCapability
(
cameraArray
[
0
],
cameraModeArray
[
0
]);
if
(
!
cameraOutputCap
)
{
console
.
error
(
"
modeManager.getSupportedOutputCapability error
"
)
return
;
}
console
.
info
(
"
outputCapability:
"
+
JSON
.
stringify
(
cameraOutputCap
));
let
previewProfilesArray
=
cameraOutputCap
.
previewProfiles
;
if
(
!
previewProfilesArray
)
{
console
.
error
(
"
createOutput previewProfilesArray == null || undefined
"
)
}
let
photoProfilesArray
=
cameraOutputCap
.
photoProfiles
;
if
(
!
photoProfilesArray
)
{
console
.
error
(
"
createOutput photoProfilesArray == null || undefined
"
)
}
// 创建预览输出流,其中参数 surfaceId 参考上文 XComponent 组件,预览流为XComponent组件提供的surface
let
previewOutput
try
{
previewOutput
=
cameraManager
.
createPreviewOutput
(
previewProfilesArray
[
0
],
surfaceId
)
}
catch
(
error
)
{
console
.
error
(
"
Failed to create the PreviewOutput instance.
"
)
}
// 监听预览输出错误信息
previewOutput
.
on
(
'
error
'
,
(
error
)
=>
{
console
.
info
(
`Preview output error code:
${
error
.
code
}
`
);
})
// 创建ImageReceiver对象,并设置照片参数:分辨率大小是根据前面 photoProfilesArray 获取的当前设备所支持的拍照分辨率大小去设置
let
imageReceiver
=
await
image
.
createImageReceiver
(
1920
,
1080
,
4
,
8
)
// 获取照片显示SurfaceId
let
photoSurfaceId
=
await
imageReceiver
.
getReceivingSurfaceId
()
// 创建拍照输出流
let
photoOutput
try
{
photoOutput
=
cameraManager
.
createPhotoOutput
(
photoProfilesArray
[
0
],
photoSurfaceId
)
}
catch
(
error
)
{
console
.
error
(
'
Failed to createPhotoOutput errorCode =
'
+
error
.
code
);
}
//创建portrait会话
let
portraitSession
try
{
portraitSession
=
modeManager
.
createCaptureSession
(
cameraModeArray
[
0
])
}
catch
(
error
)
{
console
.
error
(
'
Failed to create the CaptureSession instance. errorCode =
'
+
error
.
code
);
}
// 监听portraitSession错误信息
portraitSession
.
on
(
'
error
'
,
(
error
)
=>
{
console
.
info
(
`Capture session error code:
${
error
.
code
}
`
);
})
// 开始配置会话
try
{
portraitSession
.
beginConfig
()
}
catch
(
error
)
{
console
.
error
(
'
Failed to beginConfig. errorCode =
'
+
error
.
code
);
}
// 向会话中添加相机输入流
try
{
portraitSession
.
addInput
(
cameraInput
)
}
catch
(
error
)
{
console
.
error
(
'
Failed to addInput. errorCode =
'
+
error
.
code
);
}
// 向会话中添加预览输出流
try
{
portraitSession
.
addOutput
(
previewOutput
)
}
catch
(
error
)
{
console
.
error
(
'
Failed to addOutput(previewOutput). errorCode =
'
+
error
.
code
);
}
// 向会话中添加拍照输出流
try
{
portraitSession
.
addOutput
(
photoOutput
)
}
catch
(
error
)
{
console
.
error
(
'
Failed to addOutput(photoOutput). errorCode =
'
+
error
.
code
);
}
// 提交会话配置
await
portraitSession
.
commitConfig
()
// 启动会话
await
portraitSession
.
start
().
then
(()
=>
{
console
.
info
(
'
Promise returned to indicate the session start success.
'
);
})
// 获取支持的美颜类型
let
beautyTypes
try
{
beautyTypes
=
portraitSession
.
getSupportedBeautyTypes
()
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the beauty types. errorCode =
'
+
error
.
code
);
}
// 获取支持的美颜类型对应的美颜强度范围
let
beautyRanges
try
{
beautyRanges
=
portraitSession
.
getSupportedBeautyRanges
(
beautyTypes
[
0
])
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the beauty types ranges. errorCode =
'
+
error
.
code
);
}
// 设置美颜类型及对应的美颜强度
try
{
portraitSession
.
setBeauty
(
beautyTypes
[
0
],
beautyRanges
[
0
])
}
catch
(
error
)
{
console
.
error
(
'
Failed to set the beauty type value. errorCode =
'
+
error
.
code
);
}
// 获取已经设置的美颜类型对应的美颜强度
let
beautyLevel
try
{
beautyLevel
=
portraitSession
.
getBeauty
(
beautyTypes
[
0
])
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the beauty type value. errorCode =
'
+
error
.
code
);
}
// 获取支持的滤镜类型
let
filterTypes
try
{
filterTypes
=
portraitSession
.
getSupportedFilters
()
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the filter types. errorCode =
'
+
error
.
code
);
}
// 设置滤镜类型
try
{
portraitSession
.
setFilter
(
filterTypes
[
0
])
}
catch
(
error
)
{
console
.
error
(
'
Failed to set the filter type value. errorCode =
'
+
error
.
code
);
}
// 获取已经设置的滤镜类型
let
filter
try
{
filter
=
portraitSession
.
getFilter
()
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the filter type value. errorCode =
'
+
error
.
code
);
}
// 获取支持的虚化类型
let
portraitTypes
try
{
portraitTypes
=
portraitSession
.
getSupportedPortraitEffects
()
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the portrait effects types. errorCode =
'
+
error
.
code
);
}
// 设置虚化类型
try
{
portraitSession
.
setPortraitEffect
(
portraitTypes
[
0
])
}
catch
(
error
)
{
console
.
error
(
'
Failed to set the portrait effects value. errorCode =
'
+
error
.
code
);
}
// 获取已经设置的虚化类型
let
effect
try
{
effect
=
portraitSession
.
getPortraitEffect
()
}
catch
(
error
)
{
console
.
error
(
'
Failed to get the portrait effects value. errorCode =
'
+
error
.
code
);
}
// 使用当前拍照设置进行拍照
photoOutput
.
capture
(
settings
,
async
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to capture the photo ${err.message}
'
);
return
;
}
console
.
info
(
'
Callback invoked to indicate the photo capture request success.
'
);
});
// 停止当前会话
portraitSession
.
stop
()
// 释放相机输入流
cameraInput
.
close
()
// 释放预览输出流
previewOutput
.
release
()
// 释放拍照输出流
photoOutput
.
release
()
// 释放会话
portraitSession
.
release
()
// 会话置空
portraitSession
=
null
```
zh-cn/application-dev/media/figures/portrait-capture-development-process.png
0 → 100644
浏览文件 @
b60efb58
727.8 KB
zh-cn/application-dev/quick-start/Readme-CN.md
浏览文件 @
b60efb58
...
@@ -23,9 +23,6 @@
...
@@ -23,9 +23,6 @@
-
HSP
-
HSP
-
[
应用内HSP开发指导
](
in-app-hsp.md
)
-
[
应用内HSP开发指导
](
in-app-hsp.md
)
-
[
应用间HSP开发指导
](
cross-app-hsp.md
)
-
[
应用间HSP开发指导
](
cross-app-hsp.md
)
-
原子化服务
-
[
原子化服务开发指导
](
atomicService.md
)
-
[
原子化服务空间管理(仅对系统应用开放)
](
atomicService-aging.md
)
-
应用程序包快速修复
-
应用程序包快速修复
-
[
快速修复概述
](
quickfix-principles.md
)
-
[
快速修复概述
](
quickfix-principles.md
)
-
[
快速修复命令行调试开发指导
](
quickfix-debug.md
)
-
[
快速修复命令行调试开发指导
](
quickfix-debug.md
)
...
...
zh-cn/application-dev/quick-start/arkts-create-custom-components.md
浏览文件 @
b60efb58
...
@@ -131,14 +131,14 @@ struct ParentComponent {
...
@@ -131,14 +131,14 @@ struct ParentComponent {
```
```
-
\@
Re
cycle:
\@
Recyc
le装饰的自定义组件具备可复用能力
-
\@
Re
usable:
\@
Reusab
le装饰的自定义组件具备可复用能力
> **说明:**
> **说明:**
>
>
> 从API version 10开始,该装饰器支持在ArkTS卡片中使用。
> 从API version 10开始,该装饰器支持在ArkTS卡片中使用。
```
ts
```
ts
@
Re
cyc
le
@
Re
usab
le
@
Component
@
Component
struct
MyComponent
{
struct
MyComponent
{
}
}
...
...
zh-cn/application-dev/quick-start/arkts-localstorage.md
浏览文件 @
b60efb58
...
@@ -36,7 +36,7 @@ LocalStorage根据与\@Component装饰的组件的同步类型不同,提供了
...
@@ -36,7 +36,7 @@ LocalStorage根据与\@Component装饰的组件的同步类型不同,提供了
## 限制条件
## 限制条件
-
LocalStorage创建后,命名属性的类型不可更改。后续调用Set时必须使用相同类型的值。
-
LocalStorage创建后,命名属性的类型不可更改。后续调用Set时必须使用相同类型的值。
-
LocalStorage是页面级存储,
[
GetShared
](
../reference/arkui-ts/ts-state-management.md#getshared10
)
接口仅能获取当前
stage,
通过
[
windowStage.loadContent
](
../reference/apis/js-apis-window.md#loadcontent9
)
传入的LocalStorage实例,否则返回undefined。例子可见
[
将LocalStorage实例从UIAbility共享到一个或多个视图
](
#将localstorage实例从uiability共享到一个或多个视图
)
。
-
LocalStorage是页面级存储,
[
GetShared
](
../reference/arkui-ts/ts-state-management.md#getshared10
)
接口仅能获取当前
Stage
通过
[
windowStage.loadContent
](
../reference/apis/js-apis-window.md#loadcontent9
)
传入的LocalStorage实例,否则返回undefined。例子可见
[
将LocalStorage实例从UIAbility共享到一个或多个视图
](
#将localstorage实例从uiability共享到一个或多个视图
)
。
## \@LocalStorageProp
## \@LocalStorageProp
...
@@ -402,7 +402,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -402,7 +402,7 @@ export default class EntryAbility extends UIAbility {
```
ts
```
ts
// 通过GetShared接口获取stage共享的Storage实例
// 通过GetShared接口获取stage共享的
Local
Storage实例
let
storage
=
LocalStorage
.
GetShared
()
let
storage
=
LocalStorage
.
GetShared
()
@
Entry
(
storage
)
@
Entry
(
storage
)
...
...
zh-cn/application-dev/quick-start/arkts-observed-and-objectlink.md
浏览文件 @
b60efb58
...
@@ -162,6 +162,26 @@ class ClassB {
...
@@ -162,6 +162,26 @@ class ClassB {
this
.
a
=
a
;
this
.
a
=
a
;
}
}
}
}
@
Observed
class
ClassD
{
public
c
:
ClassC
;
constructor
(
c
:
ClassC
)
{
this
.
c
=
c
;
}
}
@
Observed
class
ClassC
extends
ClassA
{
public
k
:
number
;
constructor
(
k
:
number
)
{
// 调用父类方法对k进行处理
super
(
k
);
this
.
k
=
k
;
}
}
```
```
...
@@ -169,60 +189,64 @@ class ClassB {
...
@@ -169,60 +189,64 @@ class ClassB {
```
ts
```
ts
@
Component
@
Component
struct
View
A
{
struct
View
C
{
label
:
string
=
'
View
A
1
'
;
label
:
string
=
'
View
C
1
'
;
@
ObjectLink
a
:
ClassA
;
@
ObjectLink
c
:
ClassC
;
build
()
{
build
()
{
Row
()
{
Row
()
{
Button
(
`ViewA [
${
this
.
label
}
] this.a.c=
${
this
.
a
.
c
}
+1`
)
Column
()
{
.
onClick
(()
=>
{
Text
(
`ViewC [
${
this
.
label
}
] this.a.c =
${
this
.
c
.
c
}
`
)
this
.
a
.
c
+=
1
;
.
fontColor
(
'
#ffffffff
'
)
})
.
backgroundColor
(
'
#ff3fc4c4
'
)
}
.
height
(
50
)
.
borderRadius
(
25
)
Button
(
`ViewC: this.c.c add 1`
)
.
backgroundColor
(
'
#ff7fcf58
'
)
.
onClick
(()
=>
{
this
.
c
.
c
+=
1
;
console
.
log
(
'
this.c.c:
'
+
this
.
c
.
c
)
})
}
.
width
(
300
)
}
}
}
}
}
@
Entry
@
Entry
@
Component
@
Component
struct
ViewB
{
struct
ViewB
{
@
State
b
:
ClassB
=
new
ClassB
(
new
ClassA
(
0
));
@
State
b
:
ClassB
=
new
ClassB
(
new
ClassA
(
0
));
@
State
child
:
ClassD
=
new
ClassD
(
new
ClassC
(
0
));
build
()
{
build
()
{
Column
()
{
Column
()
{
ViewA
({
label
:
'
ViewA #1
'
,
a
:
this
.
b
.
a
})
ViewC
({
label
:
'
ViewC #3
'
,
c
:
this
.
child
.
c
})
ViewA
({
label
:
'
ViewA #2
'
,
a
:
this
.
b
.
a
})
Button
(
`ViewC: this.child.c.c add 10`
)
.
backgroundColor
(
'
#ff7fcf58
'
)
Button
(
`ViewB: this.b.a.c+= 1`
)
.
onClick
(()
=>
{
this
.
b
.
a
.
c
+=
1
;
})
Button
(
`ViewB: this.b.a = new ClassA(0)`
)
.
onClick
(()
=>
{
.
onClick
(()
=>
{
this
.
b
.
a
=
new
ClassA
(
0
);
this
.
child
.
c
.
c
+=
10
})
console
.
log
(
'
this.child.c.c:
'
+
this
.
child
.
c
.
c
)
Button
(
`ViewB: this.b = new ClassB(ClassA(0))`
)
.
onClick
(()
=>
{
this
.
b
=
new
ClassB
(
new
ClassA
(
0
));
})
})
}
}
}
}
}
}
```
```
被@Observed装饰的ClassC类,可以观测到继承基类的属性的变化。
ViewB中的事件句柄:
ViewB中的事件句柄:
-
this.
b.a
= new ClassA(0) 和this.b = new ClassB(new ClassA(0)): 对
\@
State装饰的变量b和其属性的修改。
-
this.
child.c
= new ClassA(0) 和this.b = new ClassB(new ClassA(0)): 对
\@
State装饰的变量b和其属性的修改。
-
this.
b.a
.c = ... :该变化属于第二层的变化,
[
@State
](
arkts-state.md#观察变化
)
无法观察到第二层的变化,但是ClassA被
\@
Observed装饰,ClassA的属性c的变化可以被
\@
ObjectLink观察到。
-
this.
child.c
.c = ... :该变化属于第二层的变化,
[
@State
](
arkts-state.md#观察变化
)
无法观察到第二层的变化,但是ClassA被
\@
Observed装饰,ClassA的属性c的变化可以被
\@
ObjectLink观察到。
View
A
中的事件句柄:
View
C
中的事件句柄:
-
this.
a
.c += 1:对
\@
ObjectLink变量a的修改,将触发Button组件的刷新。
\@
ObjectLink和
\@
Prop不同,
\@
ObjectLink不拷贝来自父组件的数据源,而是在本地构建了指向其数据源的引用。
-
this.
c
.c += 1:对
\@
ObjectLink变量a的修改,将触发Button组件的刷新。
\@
ObjectLink和
\@
Prop不同,
\@
ObjectLink不拷贝来自父组件的数据源,而是在本地构建了指向其数据源的引用。
-
\@
ObjectLink变量是只读的,this.a = new ClassA(...)是不允许的,因为一旦赋值操作发生,指向数据源的引用将被重置,同步将被打断。
-
\@
ObjectLink变量是只读的,this.a = new ClassA(...)是不允许的,因为一旦赋值操作发生,指向数据源的引用将被重置,同步将被打断。
...
...
zh-cn/application-dev/quick-start/arkts-prop.md
浏览文件 @
b60efb58
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
| 装饰器参数 | 无 |
| 装饰器参数 | 无 |
| 同步类型 | 单向同步:对父组件状态变量值的修改,将同步给子组件
\@
Prop装饰的变量,子组件
\@
Prop变量的修改不会同步到父组件的状态变量上。嵌套类型的场景请参考
[
观察变化
](
#观察变化
)
。 |
| 同步类型 | 单向同步:对父组件状态变量值的修改,将同步给子组件
\@
Prop装饰的变量,子组件
\@
Prop变量的修改不会同步到父组件的状态变量上。嵌套类型的场景请参考
[
观察变化
](
#观察变化
)
。 |
| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。
<br/>不支持any,不支持简单类型和复杂类型的联合类型,不允许使用undefined和null。<br/>支持Date类型。<br/>支持类型的场景请参考[观察变化](#观察变化)。<br/>必须指定类型。<br/>**说明** :<br/>不支持Length、ResourceStr、ResourceColor类型,Length,ResourceStr、ResourceColor为简单类型和复杂类型的联合类型。<br/>在父组件中,传递给\@Prop装饰的值不能为undefined或者null,反例如下所示。<br/>CompA ({ aProp: undefined })<br/>CompA ({ aProp: null })<br/>\@Prop和[数据源](arkts-state-management-overview.md#基本概念)类型需要相同,有以下三种情况:<br/>- \@Prop装饰的变量和\@State以及其他装饰器同步时双方的类型必须相同,示例请参考[父组件@State到子组件@Prop简单数据类型同步](#父组件state到子组件prop简单数据类型同步)。<br/>- \@Prop装饰的变量和\@State以及其他装饰器装饰的数组的项同步时 ,\@Prop的类型需要和\@State装饰的数组的数组项相同,比如\@Prop : T和\@State : Array<T>,示例请参考[父组件@State数组中的项到子组件@Prop简单数据类型同步](#父组件state数组项到子组件prop简单数据类型同步);<br/>
-
当父组件状态变量为Object或者class时,
\@
Prop装饰的变量和父组件状态变量的属性类型相同,示例请参考
[
从父组件中的@State类对象属性到@Prop简单类型的同步
](
#从父组件中的state类对象属性到prop简单类型的同步
)
。 |
| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。
<br/>不支持any,不支持简单类型和复杂类型的联合类型,不允许使用undefined和null。<br/>支持Date类型。<br/>支持类型的场景请参考[观察变化](#观察变化)。<br/>必须指定类型。<br/>**说明** :<br/>不支持Length、ResourceStr、ResourceColor类型,Length,ResourceStr、ResourceColor为简单类型和复杂类型的联合类型。<br/>在父组件中,传递给\@Prop装饰的值不能为undefined或者null,反例如下所示。<br/>CompA ({ aProp: undefined })<br/>CompA ({ aProp: null })<br/>\@Prop和[数据源](arkts-state-management-overview.md#基本概念)类型需要相同,有以下三种情况:<br/>- \@Prop装饰的变量和\@State以及其他装饰器同步时双方的类型必须相同,示例请参考[父组件@State到子组件@Prop简单数据类型同步](#父组件state到子组件prop简单数据类型同步)。<br/>- \@Prop装饰的变量和\@State以及其他装饰器装饰的数组的项同步时 ,\@Prop的类型需要和\@State装饰的数组的数组项相同,比如\@Prop : T和\@State : Array<T>,示例请参考[父组件@State数组中的项到子组件@Prop简单数据类型同步](#父组件state数组项到子组件prop简单数据类型同步);<br/>
-
当父组件状态变量为Object或者class时,
\@
Prop装饰的变量和父组件状态变量的属性类型相同,示例请参考
[
从父组件中的@State类对象属性到@Prop简单类型的同步
](
#从父组件中的state类对象属性到prop简单类型的同步
)
。 |
| 嵌套传递层数 | 在组件复用场景,建议@Prop深度嵌套数据不要超过5层,嵌套太多会导致深拷贝占用的空间过大以及GarbageCollection(垃圾回收),引起性能问题,此时更建议使用
[
\@ObjectLink
](
arkts-observed-and-objectlink.md
)
。如果子组件的数据不想同步回父组件,建议采用@Reusable中的aboutToReuse,实现父组件向子组件传递数据,具体用例请参考
[
组件复用场景
](
arkts-state-management-best-practices.md
)
。 |
| 被装饰变量的初始值 | 允许本地初始化。 |
| 被装饰变量的初始值 | 允许本地初始化。 |
...
@@ -32,7 +33,7 @@
...
@@ -32,7 +33,7 @@
| 传递/访问 | 说明 |
| 传递/访问 | 说明 |
| --------- | ---------------------------------------- |
| --------- | ---------------------------------------- |
| 从父组件初始化 | 如果本地有初始化,则是可选的。没有的话,则必选,支持父组件中的常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide、
\@
Consume、
\@
ObjectLink、
\@
StorageLink、
\@
StorageProp、
\@
LocalStorageLink和
\@
LocalStorageProp去初始化子组件中的
\@
Prop变量。 |
| 从父组件初始化 | 如果本地有初始化,则是可选的。没有的话,则必选,支持父组件中的常规变量
(常规变量对@Prop赋值,只是数值的初始化,常规变量的变化不会触发UI刷新。只有状态变量才能触发UI刷新)
、
\@
State、
\@
Link、
\@
Prop、
\@
Provide、
\@
Consume、
\@
ObjectLink、
\@
StorageLink、
\@
StorageProp、
\@
LocalStorageLink和
\@
LocalStorageProp去初始化子组件中的
\@
Prop变量。 |
| 用于初始化子组件 |
\@
Prop支持去初始化子组件中的常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide。 |
| 用于初始化子组件 |
\@
Prop支持去初始化子组件中的常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide。 |
| 是否支持组件外访问 |
\@
Prop装饰的变量是私有的,只能在组件内访问。 |
| 是否支持组件外访问 |
\@
Prop装饰的变量是私有的,只能在组件内访问。 |
...
@@ -50,7 +51,7 @@
...
@@ -50,7 +51,7 @@
\@
Prop装饰的数据可以观察到以下变化。
\@
Prop装饰的数据可以观察到以下变化。
-
当装饰的类型是允许的类型,即Object、class、string、number、boolean、enum类型都可以观察到
的赋值
变化。
-
当装饰的类型是允许的类型,即Object、class、string、number、boolean、enum类型都可以观察到
赋值的
变化。
```
ts
```
ts
// 简单类型
// 简单类型
...
@@ -88,29 +89,7 @@ this.title.value = 'Hi'
...
@@ -88,29 +89,7 @@ this.title.value = 'Hi'
this.title.a.value = 'ArkUi'
this.title.a.value = 'ArkUi'
```
```
对于嵌套场景,如果装饰的class是被
\@
Observed装饰的,可以观察到class属性的变化。
对于嵌套场景,如果class是被
\@
Observed装饰的,可以观察到class属性的变化,示例请参考
[
@Prop嵌套场景
](
#@Prop嵌套场景
)
。
```
@Observed
class ClassA {
public value: string;
constructor(value: string) {
this.value = value;
}
}
class Model {
public value: string;
public a: ClassA;
constructor(value: string, a: ClassA) {
this.value = value;
this.a = a;
}
}
@Prop title: Model;
// 可以观察到第一层的变化
this.title.value = 'Hi'
// 可以观察到ClassA属性的变化,因为ClassA被@Observed装饰this.title.a.value = 'ArkUi'
```
当装饰的类型是数组的时候,可以观察到数组本身的赋值、添加、删除和更新。
当装饰的类型是数组的时候,可以观察到数组本身的赋值、添加、删除和更新。
...
@@ -568,4 +547,88 @@ struct MainProgram {
...
@@ -568,4 +547,88 @@ struct MainProgram {
}
}
}
}
```
```
### \@Prop嵌套场景
在嵌套场景下,每一层都要用@Observed装饰,且每一层都要被@Prop接收,这样才能观察到嵌套场景。
```
ts
// 以下是嵌套类对象的数据结构。
@
Observed
class
ClassA
{
public
title
:
string
;
constructor
(
title
:
string
)
{
this
.
title
=
title
;
}
}
@
Observed
class
ClassB
{
public
name
:
string
;
public
a
:
ClassA
;
constructor
(
name
:
string
,
a
:
ClassA
)
{
this
.
name
=
name
;
this
.
a
=
a
;
}
}
```
以下组件层次结构呈现的是@Prop嵌套场景的数据结构。
```
ts
@
Entry
@
Component
struct
Parent
{
@
State
votes
:
ClassB
=
new
ClassB
(
'
Hello
'
,
new
ClassA
(
'
world
'
))
build
()
{
Column
()
{
Button
(
'
change
'
)
.
onClick
(()
=>
{
this
.
votes
.
name
=
"
aaaaa
"
this
.
votes
.
a
.
title
=
"
wwwww
"
})
Child
({
vote
:
this
.
votes
})
}
}
}
@
Component
struct
Child
{
@
Prop
vote
:
ClassB
build
()
{
Column
()
{
Text
(
this
.
vote
.
name
).
fontSize
(
36
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
this
.
vote
.
name
=
'
Bye
'
})
Text
(
this
.
vote
.
a
.
title
).
fontSize
(
36
).
fontColor
(
Color
.
Blue
)
.
onClick
(()
=>
{
this
.
vote
.
a
.
title
=
"
openHarmony
"
})
Child1
({
vote1
:
this
.
vote
.
a
})
}
}
}
@
Component
struct
Child1
{
@
Prop
vote1
:
ClassA
build
()
{
Column
()
{
Text
(
this
.
vote1
.
title
).
fontSize
(
36
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
this
.
vote1
.
title
=
'
Bye Bye
'
})
}
}
}
```
<!--no_check-->
<!--no_check-->
\ No newline at end of file
zh-cn/application-dev/quick-start/arkts-provide-and-consume.md
浏览文件 @
b60efb58
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
|
\@
Provide传递/访问 | 说明 |
|
\@
Provide传递/访问 | 说明 |
| -------------- | ---------------------------------------- |
| -------------- | ---------------------------------------- |
| 从父组件初始化和更新 | 可选,允许父组件中常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide、
\@
Consume、
\@
ObjectLink、
\@
StorageLink、
\@
StorageProp、
\@
LocalStorageLink和
\@
LocalStorageProp装饰的变量装饰变量初始化子组件
\@
Provide。 |
| 从父组件初始化和更新 | 可选,允许父组件中常规变量
(常规变量对@Prop赋值,只是数值的初始化,常规变量的变化不会触发UI刷新,只有状态变量才能触发UI刷新)
、
\@
State、
\@
Link、
\@
Prop、
\@
Provide、
\@
Consume、
\@
ObjectLink、
\@
StorageLink、
\@
StorageProp、
\@
LocalStorageLink和
\@
LocalStorageProp装饰的变量装饰变量初始化子组件
\@
Provide。 |
| 用于初始化子组件 | 允许,可用于初始化
\@
State、
\@
Link、
\@
Prop、
\@
Provide。 |
| 用于初始化子组件 | 允许,可用于初始化
\@
State、
\@
Link、
\@
Prop、
\@
Provide。 |
| 和父组件同步 | 否。 |
| 和父组件同步 | 否。 |
| 和后代组件同步 | 和
\@
Consume双向同步。 |
| 和后代组件同步 | 和
\@
Consume双向同步。 |
...
...
zh-cn/application-dev/quick-start/arkts-state-management-best-practices.md
浏览文件 @
b60efb58
...
@@ -1022,4 +1022,345 @@ struct CompA {
...
@@ -1022,4 +1022,345 @@ struct CompA {
.
width
(
200
).
height
(
500
)
.
width
(
200
).
height
(
500
)
}
}
}
}
```
## 组件复用场景
子组件通过@Prop接收父组件传递的数据,如果嵌套的层数过多,会导致深拷贝占用的空间过大以及GarbageCollection(垃圾回收),引起性能问题。下面给出5层@Prop嵌套传递数据的不推荐用法及通过@Reusable实现父组件向子组件传递数据的推荐用法。
### 不推荐用法
```
ts
// 以下是嵌套类对象的数据结构。
@
Observed
class
ClassA
{
public
title
:
string
;
constructor
(
title
:
string
)
{
this
.
title
=
title
;
}
}
@
Observed
class
ClassB
{
public
name
:
string
;
public
a
:
ClassA
;
constructor
(
name
:
string
,
a
:
ClassA
)
{
this
.
name
=
name
;
this
.
a
=
a
;
}
}
@
Observed
class
ClassC
{
public
name
:
string
;
public
b
:
ClassB
;
constructor
(
name
:
string
,
b
:
ClassB
)
{
this
.
name
=
name
;
this
.
b
=
b
;
}
}
@
Observed
class
ClassD
{
public
name
:
string
;
public
c
:
ClassC
;
constructor
(
name
:
string
,
c
:
ClassC
)
{
this
.
name
=
name
;
this
.
c
=
c
;
}
}
@
Observed
class
ClassE
{
public
name
:
string
;
public
d
:
ClassD
;
constructor
(
name
:
string
,
d
:
ClassD
)
{
this
.
name
=
name
;
this
.
d
=
d
;
}
}
```
以下组件层次结构呈现的是@Prop嵌套场景的数据结构。
```
ts
@
Entry
@
Component
struct
Parent
{
@
State
vote
:
ClassE
=
new
ClassE
(
'
Hi
'
,
new
ClassD
(
'
OpenHarmony
'
,
new
ClassC
(
'
Hello
'
,
new
ClassB
(
'
World
'
,
new
ClassA
(
'
Peace
'
)))))
build
()
{
Column
()
{
Button
(
'
change
'
)
.
onClick
(()
=>
{
this
.
vote
.
name
=
"
Hello
"
})
Child
({
voteOne
:
this
.
vote
})
}
}
}
@
Component
struct
Child
{
@
Prop
voteOne
:
ClassE
build
()
{
Column
()
{
Text
(
this
.
voteOne
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteOne.name:
'
+
this
.
voteOne
.
name
);
this
.
voteOne
.
name
=
'
Bye
'
})
ChildOne
({
voteTwo
:
this
.
voteOne
.
d
})
}
}
}
@
Component
struct
ChildOne
{
@
Prop
voteTwo
:
ClassD
build
()
{
Column
()
{
Text
(
this
.
voteTwo
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteTwo.name:
'
+
this
.
voteTwo
.
name
);
this
.
voteTwo
.
name
=
'
Bye Bye
'
})
ChildTwo
({
voteThree
:
this
.
voteTwo
.
c
})
}
}
}
@
Component
struct
ChildTwo
{
@
Prop
voteThree
:
ClassC
build
()
{
Column
()
{
Text
(
this
.
voteThree
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteThree.name:
'
+
this
.
voteThree
.
name
);
this
.
voteThree
.
name
=
'
Bye Bye Bye
'
})
ChildThree
({
voteFour
:
this
.
voteThree
.
b
})
}
}
}
@
Component
struct
ChildThree
{
@
Prop
voteFour
:
ClassB
build
()
{
Column
()
{
Text
(
this
.
voteFour
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteFour.name:
'
+
this
.
voteFour
.
name
);
this
.
voteFour
.
name
=
'
Bye Bye Bye Bye
'
})
ChildFour
({
voteFive
:
this
.
voteFour
.
a
})
}
}
}
@
Component
struct
ChildFour
{
@
Prop
voteFive
:
ClassA
build
()
{
Column
()
{
Text
(
this
.
voteFive
.
title
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteFive.title:
'
+
this
.
voteFive
.
title
);
this
.
voteFive
.
title
=
'
Bye Bye Bye Bye Bye
'
})
}
}
}
```
### 推荐用法
当在组件复用场景时,父组件向子组件传递数据,子组件变化不会同步给父组件,推荐使用aboutToResue。
```
ts
// 以下是嵌套类对象的数据结构。
@
Observed
class
ClassA
{
public
title
:
string
;
constructor
(
title
:
string
)
{
this
.
title
=
title
;
}
}
@
Observed
class
ClassB
{
public
name
:
string
;
public
a
:
ClassA
;
constructor
(
name
:
string
,
a
:
ClassA
)
{
this
.
name
=
name
;
this
.
a
=
a
;
}
}
@
Observed
class
ClassC
{
public
name
:
string
;
public
b
:
ClassB
;
constructor
(
name
:
string
,
b
:
ClassB
)
{
this
.
name
=
name
;
this
.
b
=
b
;
}
}
@
Observed
class
ClassD
{
public
name
:
string
;
public
c
:
ClassC
;
constructor
(
name
:
string
,
c
:
ClassC
)
{
this
.
name
=
name
;
this
.
c
=
c
;
}
}
@
Observed
class
ClassE
{
public
name
:
string
;
public
d
:
ClassD
;
constructor
(
name
:
string
,
d
:
ClassD
)
{
this
.
name
=
name
;
this
.
d
=
d
;
}
}
```
以下组件层次结构呈现的是@Reusable组件复用场景的数据结构。
```
ts
@
Entry
@
Component
struct
Parent
{
@
State
vote
:
ClassE
=
new
ClassE
(
'
Hi
'
,
new
ClassD
(
'
OpenHarmony
'
,
new
ClassC
(
'
Hello
'
,
new
ClassB
(
'
World
'
,
new
ClassA
(
'
Peace
'
)))))
build
()
{
Column
()
{
Button
(
'
change
'
)
.
onClick
(()
=>
{
this
.
vote
.
name
=
"
Hello
"
})
.
reuseId
(
Child
.
name
)
Child
({
voteOne
:
this
.
vote
})
}
}
}
@
Reusable
@
Component
struct
Child
{
@
State
voteOne
:
ClassE
=
new
ClassE
(
'
voteOne
'
,
new
ClassD
(
'
OpenHarmony
'
,
new
ClassC
(
'
Hello
'
,
new
ClassB
(
'
World
'
,
new
ClassA
(
'
Peace
'
)))))
aboutToReuse
(
params
){
this
.
voteOne
=
params
}
build
()
{
Column
()
{
Text
(
this
.
voteOne
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
error
(
'
this.voteOne.name:
'
+
this
.
voteOne
.
name
);
this
.
voteOne
.
name
=
'
Bye
'
})
.
reuseId
(
ChildOne
.
name
)
ChildOne
({
voteTwo
:
this
.
voteOne
.
d
})
}
}
}
@
Reusable
@
Component
struct
ChildOne
{
@
State
voteTwo
:
ClassD
=
new
ClassD
(
'
voteTwo
'
,
new
ClassC
(
'
Hello
'
,
new
ClassB
(
'
World
'
,
new
ClassA
(
'
Peace
'
))))
aboutToReuse
(
params
){
this
.
voteTwo
=
params
}
build
()
{
Column
()
{
Text
(
this
.
voteTwo
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
error
(
'
this.voteTwo.name:
'
+
this
.
voteTwo
.
name
);
this
.
voteTwo
.
name
=
'
Bye Bye
'
})
.
reuseId
(
ChildTwo
.
name
)
ChildTwo
({
voteThree
:
this
.
voteTwo
.
c
})
}
}
}
@
Reusable
@
Component
struct
ChildTwo
{
@
State
voteThree
:
ClassC
=
new
ClassC
(
'
voteThree
'
,
new
ClassB
(
'
World
'
,
new
ClassA
(
'
Peace
'
)))
aboutToReuse
(
params
){
this
.
voteThree
=
params
}
build
()
{
Column
()
{
Text
(
this
.
voteThree
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteThree.name:
'
+
this
.
voteThree
.
name
);
this
.
voteThree
.
name
=
'
Bye Bye Bye
'
})
.
reuseId
(
ChildThree
.
name
)
ChildThree
({
voteFour
:
this
.
voteThree
.
b
})
}
}
}
@
Reusable
@
Component
struct
ChildThree
{
@
State
voteFour
:
ClassB
=
new
ClassB
(
'
voteFour
'
,
new
ClassA
(
'
Peace
'
))
aboutToReuse
(
params
){
this
.
voteFour
=
params
}
build
()
{
Column
()
{
Text
(
this
.
voteFour
.
name
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteFour.name:
'
+
this
.
voteFour
.
name
);
this
.
voteFour
.
name
=
'
Bye Bye Bye Bye
'
})
.
reuseId
(
ChildFour
.
name
)
ChildFour
({
voteFive
:
this
.
voteFour
.
a
})
}
}
}
@
Reusable
@
Component
struct
ChildFour
{
@
State
voteFive
:
ClassA
=
new
ClassA
(
'
voteFive
'
)
aboutToReuse
(
params
){
this
.
voteFive
=
params
}
build
()
{
Column
()
{
Text
(
this
.
voteFive
.
title
).
fontSize
(
24
).
fontColor
(
Color
.
Red
).
margin
(
50
)
.
onClick
(()
=>
{
console
.
log
(
'
this.voteFive.title:
'
+
this
.
voteFive
.
title
);
this
.
voteFive
.
title
=
'
Bye Bye Bye Bye Bye
'
})
}
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/quick-start/arkts-state.md
浏览文件 @
b60efb58
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
| 传递/访问 | 说明 |
| 传递/访问 | 说明 |
| ------------------ | ------------------------------------------------------------ |
| ------------------ | ------------------------------------------------------------ |
| 从父组件初始化 | 可选,从父组件初始化或者本地初始化。如果从父组件初始化将会覆盖本地初始化。
<br/>
支持父组件中常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide、
\@
Consume、
\@
ObjectLink、
\@
StorageLink、
\@
StorageProp、
\@
LocalStorageLink和
\@
LocalStorageProp装饰的变量,初始化子组件的
\@
State。 |
| 从父组件初始化 | 可选,从父组件初始化或者本地初始化。如果从父组件初始化将会覆盖本地初始化。
<br/>
支持父组件中常规变量
(常规变量对@Prop赋值,只是数值的初始化,常规变量的变化不会触发UI刷新,只有状态变量才能触发UI刷新)
、
\@
State、
\@
Link、
\@
Prop、
\@
Provide、
\@
Consume、
\@
ObjectLink、
\@
StorageLink、
\@
StorageProp、
\@
LocalStorageLink和
\@
LocalStorageProp装饰的变量,初始化子组件的
\@
State。 |
| 用于初始化子组件 |
\@
State装饰的变量支持初始化子组件的常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide。 |
| 用于初始化子组件 |
\@
State装饰的变量支持初始化子组件的常规变量、
\@
State、
\@
Link、
\@
Prop、
\@
Provide。 |
| 是否支持组件外访问 | 不支持,只能在组件内访问。 |
| 是否支持组件外访问 | 不支持,只能在组件内访问。 |
...
...
zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001653986573.png
100644 → 100755
查看替换文件 @
b5d35767
浏览文件 @
b60efb58
19.6 KB
|
W:
|
H:
29.4 KB
|
W:
|
H:
2-up
Swipe
Onion skin
zh-cn/application-dev/quick-start/har-package.md
浏览文件 @
b60efb58
...
@@ -4,55 +4,57 @@ HAR(Harmony Archive)是静态共享包,可以包含代码、C++库、资
...
@@ -4,55 +4,57 @@ HAR(Harmony Archive)是静态共享包,可以包含代码、C++库、资
## 创建HAR模块
## 创建HAR模块
通过DevEco Studio创建一个HAR模块,创建方式可
[
参考
](
https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/creating_har_api9-0000001518082393-V3#section143510369612
)
。
通过DevEco Studio创建一个HAR模块,创建方式可
[
参考
](
https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/creating_har_api9-0000001518082393-V3#section143510369612
)
。
需要对代码资产进行保护时,建议开启混淆能力
,
混淆能力开启后,DevEco Studio在构建HAR时,会对代码进行编译、混淆及压缩处理,保护代码资产。
需要对代码资产进行保护时,建议开启混淆能力
。
混淆能力开启后,DevEco Studio在构建HAR时,会对代码进行编译、混淆及压缩处理,保护代码资产。
注意:仅Stage模型的ArkTS工程支持混淆。
>
注意:仅Stage模型的ArkTS工程支持混淆。
### 在API9中,HAR模块默认不开启混淆能力,开启混淆能力,需要把HAR模块的build-profile.json5文件中的artifactType字段设置为obfuscation,配置如下所示
:
混淆功能在不同版本默认开启情况不同
:
```
json
-
在API 9中,HAR模块默认不开启混淆能力,开启混淆能力,需要把HAR模块的build-profile.json5文件中的artifactType字段设置为obfuscation,配置如下所示:
{
"apiType"
:
"stageMode"
,
```
json
"buildOption"
:
{
{
"artifactType"
:
"obfuscation"
"apiType"
:
"stageMode"
,
"buildOption"
:
{
"artifactType"
:
"obfuscation"
}
}
}
}
```
```
artifactType字段有以下两种取值,默认缺省为original。
artifactType字段有以下两种取值,默认缺省为original。
-
original:不混淆。
-
original:不混淆。
-
obfuscation:混淆,目前仅支持uglify混淆。
-
obfuscation:混淆,目前仅支持uglify混淆。
###
在API10中,HAR模块默认开启混淆能力,可以在HAR模块的build-profile.json5文件中的ruleOptions字段下的enable进行设置,配置如下所示:
-
在API10中,HAR模块默认开启混淆能力,可以在HAR模块的build-profile.json5文件中的ruleOptions字段下的enable进行设置,配置如下所示:
```
json
```
json
{
{
"apiType"
:
"stageMode"
,
"apiType"
:
"stageMode"
,
"buildOption"
:
{
"buildOption"
:
{
},
},
"buildOptionSet"
:
[
"buildOptionSet"
:
[
{
{
"name"
:
"release"
,
"name"
:
"release"
,
"arkOptions"
:
{
"arkOptions"
:
{
"obfuscation"
:
{
"obfuscation"
:
{
"ruleOptions"
:
{
"ruleOptions"
:
{
"enable"
:
true
,
"enable"
:
true
,
"files"
:
[
"files"
:
[
"./obfuscation-rules.txt"
"./obfuscation-rules.txt"
]
},
"consumerFiles"
:
[
"./consumer-rules.txt"
]
]
},
}
"consumerFiles"
:
[
"./consumer-rules.txt"
]
}
}
},
],
"targets"
:
[
{
"name"
:
"default"
}
}
},
]
],
}
"targets"
:
[
```
{
"name"
:
"default"
}
]
}
```
### 适配指导
### 适配指导
该字段配置前向兼容,原有功能暂时不受影响。API10后续将逐步废弃,建议尽快用新的配置方式。
该字段配置前向兼容,原有功能暂时不受影响。API10后续将逐步废弃,建议尽快用新的配置方式。
...
...
zh-cn/application-dev/quick-start/introduction-to-arkts.md
浏览文件 @
b60efb58
...
@@ -766,7 +766,7 @@ class Point {
...
@@ -766,7 +766,7 @@ class Point {
x
:
number
=
0
x
:
number
=
0
y
:
number
=
0
y
:
number
=
0
}
}
let
p
:
Point
=
{
42
,
42
}
let
p
:
Point
=
{
x
:
42
,
y
:
42
}
```
```
### 字段
### 字段
...
@@ -868,11 +868,11 @@ class Rectangle {
...
@@ -868,11 +868,11 @@ class Rectangle {
}
}
```
```
实例方法需要在类的实例上调用
:
必须通过类的实例调用实例方法
:
```
typescript
```
typescript
let
r
=
new
Rectangle
(
10
,
10
)
let
square
=
new
Rectangle
(
10
,
10
)
console
.
log
(
square
.
calculateArea
())
//
output:
100
console
.
log
(
square
.
calculateArea
())
//
输出:
100
```
```
#### 静态方法
#### 静态方法
...
@@ -883,7 +883,7 @@ console.log(square.calculateArea()) // output: 100
...
@@ -883,7 +883,7 @@ console.log(square.calculateArea()) // output: 100
所有实例都可以访问静态方法。
所有实例都可以访问静态方法。
要调用静态方法,需要使用类名
:
必须通过类名调用静态方法
:
```
typescript
```
typescript
class
Cl
{
class
Cl
{
...
@@ -1309,7 +1309,7 @@ class Stack<Element> {
...
@@ -1309,7 +1309,7 @@ class Stack<Element> {
public
pop
():
Element
{
public
pop
():
Element
{
// ...
// ...
}
}
public
push
(
e
:
Element
)
{
public
push
(
e
:
Element
)
:
void
{
// ...
// ...
}
}
}
}
...
@@ -1402,7 +1402,7 @@ foo<number>()
...
@@ -1402,7 +1402,7 @@ foo<number>()
## 空安全
## 空安全
默认情况下,ArkTS中的所有类型都是不可为空的,因此类型的值不能为空。这类似于TypeScript的严格空值检查模式(
`strictNullChecks`
),但规则更严格
,而且ArkTS中没有
`undefined`
类型
。
默认情况下,ArkTS中的所有类型都是不可为空的,因此类型的值不能为空。这类似于TypeScript的严格空值检查模式(
`strictNullChecks`
),但规则更严格。
在下面的示例中,所有行都会导致编译时错误:
在下面的示例中,所有行都会导致编译时错误:
...
@@ -1454,28 +1454,47 @@ class Person {
...
@@ -1454,28 +1454,47 @@ class Person {
### 可选链
### 可选链
可选链运算符
`?.`
可以在编写代码时遇到求值为null的表达式就停止运行
。
在访问对象属性时,如果该属性是
`undefined`
或者
`null`
,可选链运算符会返回
`undefined`
。
```
typescript
```
typescript
class
Person
{
class
Person
{
// ...
nick
:
string
|
null
=
null
spouse
:
Person
|
null
=
null
spouse
?:
Person
nick
:
string
|
null
=
null
getSpouseNick
():
string
|
null
{
setSpouse
(
spouse
:
Person
)
:
void
{
this
.
spouse
=
spouse
}
getSpouseNick
():
string
|
null
|
undefined
{
return
this
.
spouse
?.
nick
return
this
.
spouse
?.
nick
}
}
constructor
(
nick
:
string
)
{
this
.
nick
=
nick
this
.
spouse
=
undefined
}
}
}
```
```
**说明**
:
`getSpouseNick`
的返回类型必须为
`string | null
`
,因为该方法可能返回null
。
**说明**
:
`getSpouseNick`
的返回类型必须为
`string | null
| undefined`
,因为该方法可能返回
`null`
或者
`undefined`
。
可选链可以
是任何长度的,可包含任意数量的
`?.`
运算符。
可选链可以
任意长,可以包含任意数量的
`?.`
运算符。
在以下示例中,如果
某人有配偶,且配偶有昵称,则输出是该人的配偶昵称。否则,输出为空
:
在以下示例中,如果
一个
`Person`
的实例有不为空的
`spouse`
属性,且
`spouse`
有不为空的
`nickname`
属性,则输出
`spouse.nick`
。否则,输出
`undefined`
:
```
typescript
```
typescript
let
p
:
Person
=
...
class
Person
{
console
.
log
(
p
?.
spouse
?.
nick
)
nick
:
string
|
null
=
null
spouse
?:
Person
constructor
(
nick
:
string
)
{
this
.
nick
=
nick
this
.
spouse
=
undefined
}
}
let
p
:
Person
=
new
Person
(
"
Alice
"
)
console
.
log
(
p
.
spouse
?.
nick
)
// 打印undefined
```
```
## 模块
## 模块
...
...
zh-cn/application-dev/quick-start/start-with-ets-stage.md
浏览文件 @
b60efb58
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
> **说明:**
> **说明:**
>
>
> 请使用**DevEco Studio V3.0.0.900 Beta3**及更高版本。
>
> 为确保运行效果,本文以使用**DevEco Studio 4.0 Beta2**版本为例,点击[此处](../../release-notes/OpenHarmony-v4.0-beta2.md#配套关系)获取下载链接。
> 为确保运行效果,本文以使用**DevEco Studio 4.0 Beta2**版本为例,点击[此处](../../release-notes/OpenHarmony-v4.0-beta2.md#配套关系)获取下载链接。
## 创建ArkTS工程
## 创建ArkTS工程
...
...
zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-audio.md
浏览文件 @
b60efb58
...
@@ -671,7 +671,7 @@ async function createTonePlayerBefore(){
...
@@ -671,7 +671,7 @@ async function createTonePlayerBefore(){
| ------------- | --------------------------- | ---- | ---------------- |
| ------------- | --------------------------- | ---- | ---------------- |
| content |
[
ContentType
](
#contenttype
)
| 否 | 媒体类型。
<br>
API version 8、9为必填参数,从API version 10开始,变更为可选参数。 |
| content |
[
ContentType
](
#contenttype
)
| 否 | 媒体类型。
<br>
API version 8、9为必填参数,从API version 10开始,变更为可选参数。 |
| usage |
[
StreamUsage
](
#streamusage
)
| 是 | 音频流使用类型。 |
| usage |
[
StreamUsage
](
#streamusage
)
| 是 | 音频流使用类型。 |
| rendererFlags | number | 是 | 音频渲染器标志。 |
| rendererFlags | number | 是 | 音频渲染器标志。
<br>
0代表普通音频渲染器,1代表低时延音频渲染器。js接口暂不支持低时延音频渲染器。
|
## InterruptResult<sup>9+</sup>
## InterruptResult<sup>9+</sup>
...
...
zh-cn/application-dev/reference/apis/js-apis-camera.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
b60efb58
...
@@ -892,6 +892,16 @@ getColorSpace(): colorSpaceManager.ColorSpaceManager
...
@@ -892,6 +892,16 @@ getColorSpace(): colorSpaceManager.ColorSpaceManager
| ----------------------------------- | ---------------- |
| ----------------------------------- | ---------------- |
|
[
colorSpaceManager.ColorSpaceManager
](
js-apis-colorSpaceManager.md#colorspacemanager
)
| 图像广色域信息。 |
|
[
colorSpaceManager.ColorSpaceManager
](
js-apis-colorSpaceManager.md#colorspacemanager
)
| 图像广色域信息。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980101| If the image data abnormal |
| 62980103| If the image data unsupport |
| 62980115| If the image parameter invalid |
**示例:**
**示例:**
```
js
```
js
...
@@ -915,6 +925,15 @@ setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void
...
@@ -915,6 +925,15 @@ setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void
| ---------- | ----------------------------------- | ---- | --------------- |
| ---------- | ----------------------------------- | ---- | --------------- |
| colorSpace |
[
colorSpaceManager.ColorSpaceManager
](
js-apis-colorSpaceManager.md#colorspacemanager
)
| 是 | 图像广色域信息。|
| colorSpace |
[
colorSpaceManager.ColorSpaceManager
](
js-apis-colorSpaceManager.md#colorspacemanager
)
| 是 | 图像广色域信息。|
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980111| If the operation invalid |
| 62980115| If the image parameter invalid |
**示例:**
**示例:**
```
js
```
js
...
@@ -941,7 +960,7 @@ marshalling(sequence: rpc.MessageSequence): void
...
@@ -941,7 +960,7 @@ marshalling(sequence: rpc.MessageSequence): void
**错误码:**
**错误码:**
以下错误码的详细介绍请参见
文档底部图片错误码
。
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| ------- | --------------------------------------------|
...
@@ -998,7 +1017,7 @@ unmarshalling(sequence: rpc.MessageSequence): Promise\<PixelMap>
...
@@ -998,7 +1017,7 @@ unmarshalling(sequence: rpc.MessageSequence): Promise\<PixelMap>
**错误码:**
**错误码:**
以下错误码的详细介绍请参见
文档底部图片错误码
。
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| ------- | --------------------------------------------|
...
@@ -1698,7 +1717,19 @@ createPixelMapList(options?: DecodingOptions): Promise<Array\<PixelMap>>;
...
@@ -1698,7 +1717,19 @@ createPixelMapList(options?: DecodingOptions): Promise<Array\<PixelMap>>;
| 类型 | 说明 |
| 类型 | 说明 |
| -------------------------------- | --------------------- |
| -------------------------------- | --------------------- |
| Promise
<Array
<[
PixelMap
](
#pixelmap7
)
>
> | 异步返回PixelMap数组。 |
| Promise
<Array
<[
PixelMap
](
#pixelmap7
)
>
> | 异步返回PixeMap数组。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980096| If the operation invalid |
| 62980103| If the image data unsupport |
| 62980110| If the image source data error |
| 62980111| If the image source data incomplete |
| 62980118| If the image plugin create failed |
**示例:**
**示例:**
...
@@ -1728,6 +1759,18 @@ createPixelMapList(callback: AsyncCallback<Array\<PixelMap>>): void
...
@@ -1728,6 +1759,18 @@ createPixelMapList(callback: AsyncCallback<Array\<PixelMap>>): void
| -------- | ------------------------------------- | ---- | -------------------------- |
| -------- | ------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback
<Array
<[
PixelMap
](
#pixelmap7
)
>
> | 是 | 通过回调返回PixelMap数组。 |
| callback | AsyncCallback
<Array
<[
PixelMap
](
#pixelmap7
)
>
> | 是 | 通过回调返回PixelMap数组。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980096| If the operation invalid |
| 62980103| If the image data unsupport |
| 62980110| If the image source data error |
| 62980111| If the image source data incomplete |
| 62980118| If the image plugin create failed |
**示例:**
**示例:**
```
js
```
js
...
@@ -1751,6 +1794,18 @@ createPixelMapList(options: DecodingOptions, callback: AsyncCallback<Array\<Pixe
...
@@ -1751,6 +1794,18 @@ createPixelMapList(options: DecodingOptions, callback: AsyncCallback<Array\<Pixe
| options |
[
DecodingOptions
](
#decodingoptions7
)
| 是 | 解码参数。 |
| options |
[
DecodingOptions
](
#decodingoptions7
)
| 是 | 解码参数。 |
| callback | AsyncCallback
<Array
<[
PixelMap
](
#pixelmap7
)
>
> | 是 | 通过回调返回PixelMap数组。 |
| callback | AsyncCallback
<Array
<[
PixelMap
](
#pixelmap7
)
>
> | 是 | 通过回调返回PixelMap数组。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980096| If the operation invalid |
| 62980103| If the image data unsupport |
| 62980110| If the image source data error |
| 62980111| If the image source data incomplete |
| 62980118| If the image plugin create failed |
**示例:**
**示例:**
```
js
```
js
...
@@ -1781,6 +1836,20 @@ getDelayTimeList(callback: AsyncCallback<Array\<number>>): void;
...
@@ -1781,6 +1836,20 @@ getDelayTimeList(callback: AsyncCallback<Array\<number>>): void;
| -------- | -------------------- | ---- | ---------------------------------- |
| -------- | -------------------- | ---- | ---------------------------------- |
| callback | AsyncCallback
<Array
\<
number
>
> | 是 | 通过回调返回延迟时间数组。 |
| callback | AsyncCallback
<Array
\<
number
>
> | 是 | 通过回调返回延迟时间数组。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980096| If the operation invalid |
| 62980110| If the image source data error |
| 62980111| If the image source data incomplete |
| 62980113| If the image format unknown |
| 62980116| If the image decode failed |
| 62980118| If the image plugin create failed |
| 62980122| If the image decode head abnormal |
**示例:**
**示例:**
```
js
```
js
...
@@ -1803,6 +1872,20 @@ getDelayTimeList(): Promise<Array\<number>>;
...
@@ -1803,6 +1872,20 @@ getDelayTimeList(): Promise<Array\<number>>;
| -------------- | --------------------------- |
| -------------- | --------------------------- |
| Promise
<Array
\<
number
>
> | Promise实例,异步返回延迟时间数组。 |
| Promise
<Array
\<
number
>
> | Promise实例,异步返回延迟时间数组。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980096| If the operation invalid |
| 62980110| If the image source data error |
| 62980111| If the image source data incomplete |
| 62980113| If the image format unknown |
| 62980116| If the image decode failed |
| 62980118| If the image plugin create failed |
| 62980122| If the image decode head abnormal |
**示例:**
**示例:**
```
js
```
js
...
@@ -1823,6 +1906,20 @@ getFrameCount(callback: AsyncCallback\<number>): void;
...
@@ -1823,6 +1906,20 @@ getFrameCount(callback: AsyncCallback\<number>): void;
| -------- | -------------------- | ---- | ---------------------------------- |
| -------- | -------------------- | ---- | ---------------------------------- |
| callback | AsyncCallback
\<
number> | 是 | 通过回调返回图像帧数。 |
| callback | AsyncCallback
\<
number> | 是 | 通过回调返回图像帧数。 |
**错误码:**
以下错误码的详细介绍请参见
[
Image错误码
](
../errorcodes/errorcode-image.md
)
。
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------|
| 62980096| If the operation invalid |
| 62980110| If the image source data error |
| 62980111| If the image source data incomplete |
| 62980113| If the image format unknown |
| 62980116| If the image decode failed |
| 62980118| If the image plugin create failed |
| 62980122| If the image decode head abnormal |
**示例:**
**示例:**
```
js
```
js
...
@@ -3006,45 +3103,3 @@ PixelMap的初始化选项。
...
@@ -3006,45 +3103,3 @@ PixelMap的初始化选项。
-
textPath
-
textPath
-
tspan
-
tspan
-
use
-
use
### ResponseCode说明
编译错误返回的响应码。
| 名称 | 值 | 说明 |
| ----------------------------------- | -------- | --------------------------------------------------- |
| ERR_MEDIA_INVALID_VALUE | -1 | 无效大小。 |
| SUCCESS | 0 | 操作成功。 |
| ERROR | 62980096 | 操作失败。 |
| ERR_IPC | 62980097 | ipc错误。 |
| ERR_SHAMEM_NOT_EXIST | 62980098 | 共享内存错误。 |
| ERR_SHAMEM_DATA_ABNORMAL | 62980099 | 共享内存错误。 |
| ERR_IMAGE_DECODE_ABNORMAL | 62980100 | 图像解码错误。 |
| ERR_IMAGE_DATA_ABNORMAL | 62980101 | 图像输入数据错误。 |
| ERR_IMAGE_MALLOC_ABNORMAL | 62980102 | 图像malloc错误。 |
| ERR_IMAGE_DATA_UNSUPPORT | 62980103 | 不支持图像类型。 |
| ERR_IMAGE_INIT_ABNORMAL | 62980104 | 图像初始化错误。 |
| ERR_IMAGE_GET_DATA_ABNORMAL | 62980105 | 图像获取数据错误。 |
| ERR_IMAGE_TOO_LARGE | 62980106 | 图像数据太大。 |
| ERR_IMAGE_TRANSFORM | 62980107 | 图像转换错误。 |
| ERR_IMAGE_COLOR_CONVERT | 62980108 | 图像颜色转换错误。 |
| ERR_IMAGE_CROP | 62980109 | 裁剪错误。 |
| ERR_IMAGE_SOURCE_DATA | 62980110 | 图像源数据错误。 |
| ERR_IMAGE_SOURCE_DATA_INCOMPLETE | 62980111 | 图像源数据不完整。 |
| ERR_IMAGE_MISMATCHED_FORMAT | 62980112 | 图像格式不匹配。 |
| ERR_IMAGE_UNKNOWN_FORMAT | 62980113 | 图像未知格式。 |
| ERR_IMAGE_SOURCE_UNRESOLVED | 62980114 | 图像源未解析。 |
| ERR_IMAGE_INVALID_PARAMETER | 62980115 | 图像无效参数。 |
| ERR_IMAGE_DECODE_FAILED | 62980116 | 解码失败。 |
| ERR_IMAGE_PLUGIN_REGISTER_FAILED | 62980117 | 注册插件失败。 |
| ERR_IMAGE_PLUGIN_CREATE_FAILED | 62980118 | 创建插件失败。 |
| ERR_IMAGE_ENCODE_FAILED | 62980119 | 图像编码失败。 |
| ERR_IMAGE_ADD_PIXEL_MAP_FAILED | 62980120 | 图像添加像素映射失败。 |
| ERR_IMAGE_HW_DECODE_UNSUPPORT | 62980121 | 不支持图像硬件解码。 |
| ERR_IMAGE_DECODE_HEAD_ABNORMAL | 62980122 | 图像解码头错误。 |
| ERR_IMAGE_DECODE_EXIF_UNSUPPORT | 62980123 | 图像解码exif取消支持。 |
| ERR_IMAGE_PROPERTY_NOT_EXIST | 62980124 | 图像属性不存在;错误代码被媒体占用,图像从150开始。 |
| ERR_IMAGE_READ_PIXELMAP_FAILED | 62980246 | 读取像素地图失败。 |
| ERR_IMAGE_WRITE_PIXELMAP_FAILED | 62980247 | 写入像素映射失败。 |
| ERR_IMAGE_PIXELMAP_NOT_ALLOW_MODIFY | 62980248 | pixelmap不允许修改。 |
| ERR_IMAGE_CONFIG_FAILED | 62980259 | 配置错误。 |
zh-cn/application-dev/reference/apis/js-apis-installer.md
浏览文件 @
b60efb58
...
@@ -339,7 +339,7 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac
...
@@ -339,7 +339,7 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -399,7 +399,7 @@ uninstall(bundleName: string, callback: AsyncCallback<void>): void;
...
@@ -399,7 +399,7 @@ uninstall(bundleName: string, callback: AsyncCallback<void>): void;
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -451,7 +451,7 @@ uninstall(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
...
@@ -451,7 +451,7 @@ uninstall(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -514,7 +514,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&
...
@@ -514,7 +514,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.RECOVER_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.RECOVER_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -572,7 +572,7 @@ recover(bundleName: string, callback: AsyncCallback<void>): void;
...
@@ -572,7 +572,7 @@ recover(bundleName: string, callback: AsyncCallback<void>): void;
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.RECOVER_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.RECOVER_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -622,7 +622,7 @@ recover(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
...
@@ -622,7 +622,7 @@ recover(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.RECOVER_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.RECOVER_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -682,7 +682,7 @@ uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\<void>) : voi
...
@@ -682,7 +682,7 @@ uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\<void>) : voi
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -736,7 +736,7 @@ uninstall(uninstallParam: UninstallParam) : Promise\<void>;
...
@@ -736,7 +736,7 @@ uninstall(uninstallParam: UninstallParam) : Promise\<void>;
**系统接口:**
此接口为系统接口。
**系统接口:**
此接口为系统接口。
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
<sup>
10+
</sup>
**需要权限:**
ohos.permission.INSTALL_BUNDLE 或 ohos.permission.UNINSTALL_BUNDLE
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Core
...
@@ -789,7 +789,7 @@ try {
...
@@ -789,7 +789,7 @@ try {
## BundleInstaller.updateBundleForSelf<sup>10+</sup>
## BundleInstaller.updateBundleForSelf<sup>10+</sup>
updateBundleForSelf(hapFilePaths: Array
<string>
, installParam: InstallParam, callback: AsyncCallback
<void
>
): void;
updateBundleForSelf(hapFilePaths: Array
\<
string
\>
, installParam: InstallParam, callback: AsyncCallback
\<
void
\
>
): void;
以异步方法更新当前应用,仅限企业设备上的企业MDM应用调用,且传入的hapFilePaths中的hap必须都属于当前应用,使用callback形式返回结果。
以异步方法更新当前应用,仅限企业设备上的企业MDM应用调用,且传入的hapFilePaths中的hap必须都属于当前应用,使用callback形式返回结果。
...
@@ -821,7 +821,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, installParam: InstallParam, cal
...
@@ -821,7 +821,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, installParam: InstallParam, cal
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700041 | Failed to install because enterprise device management disallow install. |
| 17700041 | Failed to install because enterprise device management disallow install. |
| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
...
@@ -863,7 +862,7 @@ try {
...
@@ -863,7 +862,7 @@ try {
## BundleInstaller.updateBundleForSelf<sup>10+</sup>
## BundleInstaller.updateBundleForSelf<sup>10+</sup>
updateBundleForSelf(hapFilePaths: Array
<string>
, callback: AsyncCallback
<void
>
): void;
updateBundleForSelf(hapFilePaths: Array
\<
string
\>
, callback: AsyncCallback
\<
void
\
>
): void;
以异步方法更新当前应用,仅限企业设备上的企业MDM应用调用,且传入的hapFilePaths中的hap必须都属于当前应用,使用callback形式返回结果。
以异步方法更新当前应用,仅限企业设备上的企业MDM应用调用,且传入的hapFilePaths中的hap必须都属于当前应用,使用callback形式返回结果。
...
@@ -886,7 +885,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, callback: AsyncCallback<void>):
...
@@ -886,7 +885,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, callback: AsyncCallback<void>):
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------------ |
| -------- | ------------------------------------------------------------ |
| 17700004 | The specified user ID is not found. |
| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
...
@@ -894,7 +892,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, callback: AsyncCallback<void>):
...
@@ -894,7 +892,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, callback: AsyncCallback<void>):
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700041 | Failed to install because enterprise device management disallow install. |
| 17700041 | Failed to install because enterprise device management disallow install. |
| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
...
@@ -931,7 +928,7 @@ try {
...
@@ -931,7 +928,7 @@ try {
## BundleInstaller.updateBundleForSelf<sup>10+</sup>
## BundleInstaller.updateBundleForSelf<sup>10+</sup>
updateBundleForSelf(hapFilePaths: Array
<string>
, installParam?: InstallParam): Promise
<void
>
;
updateBundleForSelf(hapFilePaths: Array
\<
string
\>
, installParam?: InstallParam): Promise
\<
void
\
>
;
以异步方法更新当前应用,仅限企业设备上的企业MDM应用调用,且传入的hapFilePaths中的hap必须都属于当前应用,使用promise形式返回结果。
以异步方法更新当前应用,仅限企业设备上的企业MDM应用调用,且传入的hapFilePaths中的hap必须都属于当前应用,使用promise形式返回结果。
...
@@ -962,7 +959,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, installParam?: InstallParam): P
...
@@ -962,7 +959,6 @@ updateBundleForSelf(hapFilePaths: Array<string>, installParam?: InstallParam): P
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700041 | Failed to install because enterprise device management disallow install. |
| 17700041 | Failed to install because enterprise device management disallow install. |
| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
...
...
zh-cn/application-dev/reference/apis/js-apis-net-connection.md
浏览文件 @
b60efb58
...
@@ -1415,7 +1415,7 @@ netCon.unregister(function (error) {
...
@@ -1415,7 +1415,7 @@ netCon.unregister(function (error) {
### on('netCapabilitiesChange')<sup>8+</sup>
### on('netCapabilitiesChange')<sup>8+</sup>
on(type: 'netCapabilitiesChange', callback: Callback
<
{
netHandle:
NetHandle
,
netCap:
NetCapabilities
}
>
): void
on(type: 'netCapabilitiesChange', callback: Callback
<
NetCapabilityInfo
>
): void
订阅网络能力变化事件。
订阅网络能力变化事件。
...
@@ -1428,7 +1428,7 @@ on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, net
...
@@ -1428,7 +1428,7 @@ on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, net
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 订阅事件,固定为'netCapabilitiesChange'。
<br/>
netCapabilitiesChange:网络能力变化事件。 |
| type | string | 是 | 订阅事件,固定为'netCapabilitiesChange'。
<br/>
netCapabilitiesChange:网络能力变化事件。 |
| callback | Callback
<
{
netHandle:
[
NetHandle
](
#nethandle
),
netCap:
[
NetCapabilities
](
#netcapabilities
)
}
>
| 是 | 回调函数,返回数据网络句柄(netHandle)和网络的能力信息(netCap)。|
| callback | Callback
<
[
NetCapabilityInfo
](
#netcapabilityinfo
)
>
| 是 | 回调函数,返回数据网络句柄(netHandle)和网络的能力信息(netCap)。|
**示例:**
**示例:**
...
@@ -1950,6 +1950,17 @@ connection.getDefaultNet().then(function (netHandle) {
...
@@ -1950,6 +1950,17 @@ connection.getDefaultNet().then(function (netHandle) {
| netCapabilities |
[
NetCapabilities
](
#netcapabilities
)
| 是 | 存储数据网络的传输能力和承载类型。 |
| netCapabilities |
[
NetCapabilities
](
#netcapabilities
)
| 是 | 存储数据网络的传输能力和承载类型。 |
| bearerPrivateIdentifier | string | 否 | 网络标识符,Wi-Fi网络的标识符是"wifi",蜂窝网络的标识符是"slot0"(对应SIM卡1)。 |
| bearerPrivateIdentifier | string | 否 | 网络标识符,Wi-Fi网络的标识符是"wifi",蜂窝网络的标识符是"slot0"(对应SIM卡1)。 |
## NetCapabilityInfo<sup>10+</sup>
提供承载数据网络能力的实例。
**系统能力**
:SystemCapability.Communication.NetManager.Core
| 名称 | 类型 | 必填 | 说明 |
| ----------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ |
| netHandle |
[
NetHandle
](
#nethandle
)
| 是 | 数据网络句柄。 |
| netCap |
[
NetCapabilities
](
#netcapabilities
)
| 否 | 存储数据网络的传输能力和承载类型。 |
## NetCapabilities<sup>8+</sup>
## NetCapabilities<sup>8+</sup>
网络的能力集。
网络的能力集。
...
...
zh-cn/application-dev/reference/arkui-ts/Readme-CN.md
浏览文件 @
b60efb58
...
@@ -111,7 +111,6 @@
...
@@ -111,7 +111,6 @@
-
[
Web
](
ts-basic-components-web.md
)
-
[
Web
](
ts-basic-components-web.md
)
-
[
XComponent
](
ts-basic-components-xcomponent.md
)
-
[
XComponent
](
ts-basic-components-xcomponent.md
)
-
容器组件
-
容器组件
-
[
AbilityComponent
](
ts-container-ability-component.md
)
-
[
Badge
](
ts-container-badge.md
)
-
[
Badge
](
ts-container-badge.md
)
-
[
Column
](
ts-container-column.md
)
-
[
Column
](
ts-container-column.md
)
-
[
ColumnSplit
](
ts-container-columnsplit.md
)
-
[
ColumnSplit
](
ts-container-columnsplit.md
)
...
@@ -190,5 +189,6 @@
...
@@ -190,5 +189,6 @@
-
[
类型定义
](
ts-types.md
)
-
[
类型定义
](
ts-types.md
)
-
已停止维护的组件
-
已停止维护的组件
-
[
GridContainer
](
ts-container-gridcontainer.md
)
-
[
GridContainer
](
ts-container-gridcontainer.md
)
-
[
AbilityComponent
](
ts-container-ability-component.md
)
-
已停止维护的接口
-
已停止维护的接口
-
[
点击控制
](
ts-universal-attributes-click.md
)
-
[
点击控制
](
ts-universal-attributes-click.md
)
zh-cn/application-dev/reference/arkui-ts/figures/tabContent5.gif
0 → 100755
浏览文件 @
b60efb58
828.5 KB
zh-cn/application-dev/reference/arkui-ts/figures/tabs6.gif
0 → 100755
浏览文件 @
b60efb58
1.3 MB
zh-cn/application-dev/reference/arkui-ts/figures/tabs7.gif
0 → 100755
浏览文件 @
b60efb58
1.0 MB
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md
浏览文件 @
b60efb58
...
@@ -124,4 +124,4 @@ struct SpanExample {
...
@@ -124,4 +124,4 @@ struct SpanExample {
}
}
```
```


zh-cn/application-dev/reference/arkui-ts/ts-basic-components-xcomponent.md
浏览文件 @
b60efb58
...
@@ -58,14 +58,14 @@
...
@@ -58,14 +58,14 @@
> 内部所写的非UI逻辑需要封装在一个或多个函数内。
> 内部所写的非UI逻辑需要封装在一个或多个函数内。
## 属性
## 属性
-
XComponent显示的内容,可由开发者自定义绘制,通用属性中的
[
背景设置
](
./ts-universal-attributes-background.md
)
、
[
透明度设置
](
./ts-universal-attributes-opacity.md
)
和
[
图像效果
](
./
ts-universal-attributes-image-effect.md
)
按照type类型有限支持。
-
XComponent显示的内容,可由开发者自定义绘制,通用属性中的
[
背景设置
](
ts-universal-attributes-background.md
)
、
[
透明度设置
](
ts-universal-attributes-opacity.md
)
和
[
图像效果
](
ts-universal-attributes-image-effect.md
)
按照type类型有限支持。
-
type为SURFACE("surface")时
上述通用属性均不支持
,建议使用EGL/OpenGLES提供的接口设置相关内容。
-
type为SURFACE("surface")时
仅支持
[
图像效果
](
ts-universal-attributes-image-effect.md
)
中的shadow属性
,建议使用EGL/OpenGLES提供的接口设置相关内容。
-
type为COMPONENT("component")时
上述通用属性均不支持
,建议使用挂载子组件的方式进行设置相关内容。
-
type为COMPONENT("component")时
仅支持
[
图像效果
](
ts-universal-attributes-image-effect.md
)
中的shadow属性
,建议使用挂载子组件的方式进行设置相关内容。
-
type为TEXTURE时通用属性可以支持
[
背景颜色设置
](
./ts-universal-attributes-background.md
)
和
[
透明度设置
](
./ts-universal-attributes-opacity.md
)
,
[
除颜色外的背景设置
](
./ts-universal-attributes-background.md
)
和
[
图像效果
](
./
ts-universal-attributes-image-effect.md
)
暂不支持,建议使用EGL/OpenGLES提供的接口设置相关内容。
-
type为TEXTURE时通用属性可以支持
[
背景颜色设置
](
ts-universal-attributes-background.md
)
、
[
透明度设置
](
ts-universal-attributes-opacity.md
)
和
[
图像效果
](
ts-universal-attributes-image-effect.md
)
中的shadow属性,
[
除颜色外的背景设置
](
ts-universal-attributes-background.md
)
和其他
[
图像效果
](
ts-universal-attributes-image-effect.md
)
暂不支持,建议使用EGL/OpenGLES提供的接口设置相关内容。
## 事件
## 事件
仅type为SURFACE("surface")或TEXTURE时以下事件有效。不支持
[
通用事件
](
ts-universal-events-click.md
)
和
[
手势
](
ts-gesture-settings.md
)
。
仅type为SURFACE("surface")或TEXTURE时以下事件有效。不支持
[
通用事件
](
ts-universal-events-click.md
)
。
### onLoad
### onLoad
...
...
zh-cn/application-dev/reference/arkui-ts/ts-container-ability-component.md
浏览文件 @
b60efb58
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
> **说明:**
> **说明:**
>
>
> 从API Version 10开始,该组件不再维护,推荐使用新组件[UIExtensionComponent](ts-container-ui-extension-component.md)。
>
> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
>
> 本组件为系统接口。
> 本组件为系统接口。
...
...
zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md
浏览文件 @
b60efb58
...
@@ -170,7 +170,7 @@ struct ListItemExample2 {
...
@@ -170,7 +170,7 @@ struct ListItemExample2 {
this
.
arr
.
splice
(
index
,
1
)
this
.
arr
.
splice
(
index
,
1
)
})
})
},
},
actionAreaDistance
:
80
,
actionAreaDistance
:
56
,
onEnterActionArea
:
()
=>
{
onEnterActionArea
:
()
=>
{
this
.
enterEndDeleteAreaString
=
"
enterEndDeleteArea
"
this
.
enterEndDeleteAreaString
=
"
enterEndDeleteArea
"
this
.
exitEndDeleteAreaString
=
"
not exitEndDeleteArea
"
this
.
exitEndDeleteAreaString
=
"
not exitEndDeleteArea
"
...
...
zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md
浏览文件 @
b60efb58
...
@@ -112,11 +112,11 @@ onMeasure?(children: Array<LayoutChild>, constraint: ConstraintSizeOptions
...
@@ -112,11 +112,11 @@ onMeasure?(children: Array<LayoutChild>, constraint: ConstraintSizeOptions
| children | Array
<
[LayoutChild](#layoutchild9)
>
| 子组件布局信息。 |
| children | Array
<
[LayoutChild](#layoutchild9)
>
| 子组件布局信息。 |
| constraint |
[
ConstraintSizeOptions
](
ts-types.md#constraintsizeoptions
)
| 父组件constraint信息。 |
| constraint |
[
ConstraintSizeOptions
](
ts-types.md#constraintsizeoptions
)
| 父组件constraint信息。 |
##
onRecycl
e<sup>10+</sup>
##
aboutToReus
e<sup>10+</sup>
onRecycl
e?(params: { [key: string]: unknown }): void
aboutToReus
e?(params: { [key: string]: unknown }): void
当一个可复用的自定义组件从复用缓存中重新加入到节点树时,触发
onRecycle生命周期回调,并将组件的构造参数传递给onRecycl
e。
当一个可复用的自定义组件从复用缓存中重新加入到节点树时,触发
aboutToReuse生命周期回调,并将组件的构造参数传递给aboutToReus
e。
从API version 10开始,该接口支持在ArkTS卡片中使用。
从API version 10开始,该接口支持在ArkTS卡片中使用。
...
@@ -152,10 +152,10 @@ struct Index {
...
@@ -152,10 +152,10 @@ struct Index {
}
}
}
}
@
Re
cyc
le
@
Re
usab
le
@
Component
@
Component
struct
Child
{
struct
Child
{
onRecycl
e
(
params
)
{
aboutToReus
e
(
params
)
{
console
.
info
(
"
Recycle Child
"
)
console
.
info
(
"
Recycle Child
"
)
}
}
...
...
zh-cn/application-dev/reference/errorcodes/Readme-CN.md
浏览文件 @
b60efb58
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
-
[
Media错误码
](
errorcode-media.md
)
-
[
Media错误码
](
errorcode-media.md
)
-
[
媒体会话管理错误码
](
errorcode-avsession.md
)
-
[
媒体会话管理错误码
](
errorcode-avsession.md
)
-
[
Camera错误码
](
errorcode-camera.md
)
-
[
Camera错误码
](
errorcode-camera.md
)
-
[
Image错误码
](
errorcode-image.md
)
-
资源管理
-
资源管理
-
[
I18n错误码
](
errorcode-i18n.md
)
-
[
I18n错误码
](
errorcode-i18n.md
)
-
[
资源管理错误码
](
errorcode-resource-manager.md
)
-
[
资源管理错误码
](
errorcode-resource-manager.md
)
...
...
zh-cn/application-dev/reference/errorcodes/errorcode-image.md
0 → 100644
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/application-dev/website.md
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.3/changelogs-distributeddatamgr.md
0 → 100644
浏览文件 @
b60efb58
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录