Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
caa07250
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看板
未验证
提交
caa07250
编写于
9月 05, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23929 【monthly】ArkTS适配 - 告警修改
Merge pull request !23929 from junyi233/cherry-pick-1693901932
上级
278d3bd7
da2869cb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
22 addition
and
17 deletion
+22
-17
zh-cn/application-dev/quick-start/arkts-mvvm.md
zh-cn/application-dev/quick-start/arkts-mvvm.md
+6
-6
zh-cn/application-dev/quick-start/arkts-state-management-best-practices.md
...-dev/quick-start/arkts-state-management-best-practices.md
+7
-7
zh-cn/application-dev/quick-start/arkts-watch.md
zh-cn/application-dev/quick-start/arkts-watch.md
+1
-1
zh-cn/application-dev/quick-start/in-app-hsp.md
zh-cn/application-dev/quick-start/in-app-hsp.md
+2
-1
zh-cn/application-dev/quick-start/start-with-ets-stage.md
zh-cn/application-dev/quick-start/start-with-ets-stage.md
+6
-2
未找到文件。
zh-cn/application-dev/quick-start/arkts-mvvm.md
浏览文件 @
caa07250
...
...
@@ -621,7 +621,7 @@ struct Parent {
```
ts
class
Outer
{
innerArrayProp
:
ObservedArray
<
string
>
;
innerArrayProp
:
ObservedArray
<
string
>
=
[]
;
...
}
```
...
...
@@ -689,7 +689,7 @@ struct ViewB {
(
item
:
ClassA
)
=>
{
ViewA
({
label
:
`#
${
item
.
id
}
`
,
a
:
item
})
},
(
item
:
ClassA
)
=>
item
.
id
.
toString
()
(
item
:
ClassA
)
:
string
=>
{
return
item
.
id
.
toString
();
}
)
Divider
().
height
(
10
)
...
...
@@ -738,7 +738,7 @@ struct ViewB {
@
Component
struct
ViewA
{
@
Prop
a
:
ClassA
;
@
Prop
a
:
ClassA
=
new
ClassA
(
0
)
;
label
:
string
=
"
ViewA1
"
;
build
()
{
...
...
@@ -903,7 +903,7 @@ export class ObservedArray<T> extends Array<T> {
@
ObjectLink
me
:
Person
;
@
ObjectLink
contacts
:
ObservedArray
<
Person
>
;
@
State
selectedPerson
:
Person
=
undefined
;
@
State
selectedPerson
:
Person
=
new
Person
(
""
,
""
,
0
,
""
,
[])
;
aboutToAppear
()
{
this
.
selectedPerson
=
this
.
me
;
...
...
@@ -919,7 +919,7 @@ export class ObservedArray<T> extends Array<T> {
ForEach
(
this
.
contacts
,
(
contact
:
Person
)
=>
{
PersonView
({
person
:
contact
,
phones
:
contact
.
phones
as
ObservedArray
<
string
>
,
selectedPerson
:
this
.
$selectedPerson
})
},
(
contact
:
Person
)
=>
contact
.
id_
(
contact
:
Person
)
:
string
=>
{
return
contact
.
id_
;
}
)
Divider
().
height
(
8
)
...
...
@@ -1295,7 +1295,7 @@ export class ObservedArray<T> extends Array<T> {
ForEach(this.contacts, (contact: Person) => {
PersonView({ person: contact, phones: contact.phones as ObservedArray<string>, selectedPerson: this.$selectedPerson })
},
(contact: Person)
=> contact.id_
(contact: Person)
: string => { return contact.id_; }
)
Divider().height(8)
...
...
zh-cn/application-dev/quick-start/arkts-state-management-best-practices.md
浏览文件 @
caa07250
...
...
@@ -507,8 +507,8 @@ incrSubCounter和setSubCounter都是同一个SubCounter的函数。在第一个
```
ts
@
ObjectLink
value
:
ParentCounter
;
@
ObjectLink
subValue
:
SubCounter
;
@
ObjectLink
value
:
ParentCounter
=
new
ParentCounter
(
0
)
;
@
ObjectLink
subValue
:
SubCounter
=
new
SubCounter
(
0
)
;
```
该方法使得
\@
ObjectLink分别代理了ParentCounter和SubCounter的属性,这样对于这两个类的属性的变化都可以观察到,即都会对UI视图进行刷新。即使删除了上面所说的this.counter[0].incrCounter(),UI也会进行正确的刷新。
...
...
@@ -715,8 +715,8 @@ struct ParentComp {
```
ts
@
Component
struct
CounterComp
{
@
Prop
value
:
ParentCounter
;
@
Prop
subValue
:
SubCounter
;
@
Prop
value
:
ParentCounter
=
new
ParentCounter
(
0
)
;
@
Prop
subValue
:
SubCounter
=
new
SubCounter
(
0
)
;
build
()
{
Column
({
space
:
10
})
{
Text
(
`this.subValue.counter:
${
this
.
subValue
.
counter
}
`
)
...
...
@@ -948,8 +948,8 @@ build函数中更改应用状态的行为可能会比上面的示例更加隐蔽
```
ts
@
State
arr
:
Array
<
..
>
=
[
...
];
ForEach
(
this
.
arr
.
sort
().
filter
(...
.
),
@
State
arr
:
Array
<
..
.
>
=
[
...
];
ForEach
(
this
.
arr
.
sort
().
filter
(...),
item
=>
{
...
})
...
...
@@ -959,7 +959,7 @@ ForEach(this.arr.sort().filter(....),
```
ts
ForEach
(
this
.
arr
.
filter
(...
.
).
sort
(),
ForEach
(
this
.
arr
.
filter
(...).
sort
(),
item
=>
{
...
})
...
...
zh-cn/application-dev/quick-start/arkts-watch.md
浏览文件 @
caa07250
...
...
@@ -60,7 +60,7 @@
```
ts
@
Component
struct
TotalView
{
@
Prop
@
Watch
(
'
onCountUpdated
'
)
count
:
number
;
@
Prop
@
Watch
(
'
onCountUpdated
'
)
count
:
number
=
0
;
@
State
total
:
number
=
0
;
// @Watch cb
onCountUpdated
(
propName
:
string
):
void
{
...
...
zh-cn/application-dev/quick-start/in-app-hsp.md
浏览文件 @
caa07250
...
...
@@ -145,6 +145,7 @@ export { nativeMulti } from './utils/nativeTest'
```
ts
// entry/src/main/ets/pages/index.ets
import
{
Log
,
add
,
MyTitleBar
,
ResManager
,
nativeMulti
}
from
"
library
"
import
{
BusinessError
}
from
'
@ohos.base
'
;
@
Entry
@
Component
...
...
@@ -172,7 +173,7 @@ struct Index {
.
then
(
value
=>
{
console
.
log
(
"
getStringValue is
"
+
value
);
})
.
catch
(
error
=>
{
.
catch
(
(
err
:
BusinessError
)
=>
{
console
.
log
(
"
getStringValue promise error is
"
+
error
);
});
})
...
...
zh-cn/application-dev/quick-start/start-with-ets-stage.md
浏览文件 @
caa07250
...
...
@@ -275,6 +275,7 @@
// Index.ets
// 导入页面路由模块
import
router
from
'
@ohos.router
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
@
Entry
@
Component
...
...
@@ -306,7 +307,7 @@
// 跳转到第二页
router
.
pushUrl
({
url
:
'
pages/Second
'
}).
then
(()
=>
{
console
.
info
(
'
Succeeded in jumping to the second page.
'
)
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to jump to the second page.Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
)
})
})
...
...
@@ -326,6 +327,7 @@
// Second.ets
// 导入页面路由模块
import
router
from
'
@ohos.router
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
@
Entry
@
Component
...
...
@@ -358,7 +360,9 @@
router
.
back
()
console
.
info
(
'
Succeeded in returning to the first page.
'
)
}
catch
(
err
)
{
console
.
error
(
`Failed to return to the first page.Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
)
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
error
(
`Failed to return to the first page.Code is
${
code
}
, message is
${
message
}
`
)
}
})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录