Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2ff592df
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看板
提交
2ff592df
编写于
9月 05, 2023
作者:
S
sqsyqqy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ArkTS适配
Signed-off-by:
N
sqsyqqy
<
sunqi57@huawei.com
>
上级
b5e8941b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
31 deletion
+26
-31
zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md
...rtup-and-response/improve-application-cold-start-speed.md
+3
-5
zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md
...tion-startup-and-response/improve-application-response.md
+16
-19
zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md
...ame-loss-and-frame-freezing/reduce-view-nesting-levels.md
+7
-7
未找到文件。
zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md
浏览文件 @
2ff592df
...
@@ -100,11 +100,9 @@ struct Index {
...
@@ -100,11 +100,9 @@ struct Index {
// 运算任务异步处理
// 运算任务异步处理
private
computeTaskAsync
()
{
private
computeTaskAsync
()
{
new
Promise
((
resolved
,
rejected
)
=>
{
setTimeout
(()
=>
{
// 这里使用setTimeout来实现异步延迟运行
setTimeout
(()
=>
{
// 这里使用setTimeout来实现异步延迟运行
this
.
computeTask
();
this
.
computeTask
();
},
1000
)
},
1000
)
})
}
}
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md
浏览文件 @
2ff592df
...
@@ -40,7 +40,7 @@ struct ImageExample1 {
...
@@ -40,7 +40,7 @@ struct ImageExample1 {
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
ImageExample
1
{
struct
ImageExample
2
{
build
()
{
build
()
{
Column
()
{
Column
()
{
Row
()
{
Row
()
{
...
@@ -78,7 +78,7 @@ function computeTask(arr: string[]): string[] {
...
@@ -78,7 +78,7 @@ function computeTask(arr: string[]): string[] {
@
Entry
@
Entry
@
Component
@
Component
struct
AspectRatioExample
{
struct
AspectRatioExample
3
{
@
State
children
:
string
[]
=
[
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
,
'
5
'
,
'
6
'
];
@
State
children
:
string
[]
=
[
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
,
'
5
'
,
'
6
'
];
aboutToAppear
()
{
aboutToAppear
()
{
...
@@ -88,8 +88,7 @@ struct AspectRatioExample {
...
@@ -88,8 +88,7 @@ struct AspectRatioExample {
async
computeTaskInTaskPool
()
{
async
computeTaskInTaskPool
()
{
const
param
=
this
.
children
.
slice
();
const
param
=
this
.
children
.
slice
();
let
task
=
new
taskpool
.
Task
(
computeTask
,
param
);
let
task
=
new
taskpool
.
Task
(
computeTask
,
param
);
// @ts-ignore
await
taskpool
.
execute
(
task
);
this
.
children
=
await
taskpool
.
execute
(
task
);
}
}
build
()
{
build
()
{
...
@@ -105,7 +104,7 @@ struct AspectRatioExample {
...
@@ -105,7 +104,7 @@ struct AspectRatioExample {
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
AspectRatioExample
{
struct
AspectRatioExample
4
{
@
State
private
children
:
string
[]
=
[
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
,
'
5
'
,
'
6
'
];
@
State
private
children
:
string
[]
=
[
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
,
'
5
'
,
'
6
'
];
private
count
:
number
=
0
;
private
count
:
number
=
0
;
...
@@ -123,11 +122,9 @@ struct AspectRatioExample {
...
@@ -123,11 +122,9 @@ struct AspectRatioExample {
}
}
computeTaskAsync
()
{
computeTaskAsync
()
{
new
Promise
((
resolved
,
rejected
)
=>
{
setTimeout
(()
=>
{
// 这里使用setTimeout来实现异步延迟运行
setTimeout
(()
=>
{
// 这里使用setTimeout来实现异步延迟运行
this
.
computeTask
();
this
.
computeTask
();
},
1000
)
},
1000
)
})
}
}
build
()
{
build
()
{
...
@@ -149,7 +146,7 @@ struct AspectRatioExample {
...
@@ -149,7 +146,7 @@ struct AspectRatioExample {
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
StackExample
{
struct
StackExample
5
{
@
State
isVisible
:
boolean
=
false
;
@
State
isVisible
:
boolean
=
false
;
build
()
{
build
()
{
...
@@ -178,7 +175,7 @@ struct StackExample {
...
@@ -178,7 +175,7 @@ struct StackExample {
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
StackExample
{
struct
StackExample
6
{
@
State
isVisible
:
boolean
=
false
;
@
State
isVisible
:
boolean
=
false
;
build
()
{
build
()
{
...
@@ -211,8 +208,8 @@ struct StackExample {
...
@@ -211,8 +208,8 @@ struct StackExample {
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
MyComponent
{
struct
MyComponent
7
{
@
State
arr
:
number
[]
=
Array
.
from
(
Array
(
10000
),
(
v
,
k
)
=>
k
);
@
State
arr
:
number
[]
=
Array
.
from
(
Array
<
number
>
(
10000
),
(
v
,
k
)
=>
k
);
build
()
{
build
()
{
List
()
{
List
()
{
ForEach
(
this
.
arr
,
(
item
:
number
)
=>
{
ForEach
(
this
.
arr
,
(
item
:
number
)
=>
{
...
@@ -235,8 +232,8 @@ class BasicDataSource implements IDataSource {
...
@@ -235,8 +232,8 @@ class BasicDataSource implements IDataSource {
return
0
return
0
}
}
public
getData
(
index
:
number
):
any
{
public
getData
(
index
:
number
):
string
{
return
undefined
return
''
}
}
registerDataChangeListener
(
listener
:
DataChangeListener
):
void
{
registerDataChangeListener
(
listener
:
DataChangeListener
):
void
{
...
@@ -286,13 +283,13 @@ class BasicDataSource implements IDataSource {
...
@@ -286,13 +283,13 @@ class BasicDataSource implements IDataSource {
}
}
class
MyDataSource
extends
BasicDataSource
{
class
MyDataSource
extends
BasicDataSource
{
private
dataArray
:
string
[]
=
Array
.
from
(
Array
(
10000
),
(
v
,
k
)
=>
k
.
toString
());
private
dataArray
:
string
[]
=
Array
.
from
(
Array
<
number
>
(
10000
),
(
v
,
k
)
=>
k
.
toString
());
public
totalCount
():
number
{
public
totalCount
():
number
{
return
this
.
dataArray
.
length
return
this
.
dataArray
.
length
}
}
public
getData
(
index
:
number
):
any
{
public
getData
(
index
:
number
):
string
{
return
this
.
dataArray
[
index
]
return
this
.
dataArray
[
index
]
}
}
...
@@ -318,7 +315,7 @@ struct MyComponent {
...
@@ -318,7 +315,7 @@ struct MyComponent {
ListItem
()
{
ListItem
()
{
Text
(
item
).
fontSize
(
20
).
margin
({
left
:
10
})
Text
(
item
).
fontSize
(
20
).
margin
({
left
:
10
})
}
}
},
item
=>
item
)
},
(
item
:
string
)
=>
item
)
}
}
}
}
}
}
...
...
zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md
浏览文件 @
2ff592df
...
@@ -9,13 +9,13 @@
...
@@ -9,13 +9,13 @@
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
AspectRatioExample
{
struct
AspectRatioExample
12
{
@
State
children
:
Number
[]
=
Array
.
from
(
Array
(
900
),
(
v
,
k
)
=>
k
);
@
State
children
:
Number
[]
=
Array
.
from
(
Array
<
number
>
(
900
),
(
v
,
k
)
=>
k
);
build
()
{
build
()
{
Scroll
()
{
Scroll
()
{
Grid
()
{
Grid
()
{
ForEach
(
this
.
children
,
(
item
)
=>
{
ForEach
(
this
.
children
,
(
item
:
Number
[]
)
=>
{
GridItem
()
{
GridItem
()
{
Stack
()
{
Stack
()
{
Stack
()
{
Stack
()
{
...
@@ -25,7 +25,7 @@ struct AspectRatioExample {
...
@@ -25,7 +25,7 @@ struct AspectRatioExample {
}
}
}
}
}
}
},
item
=>
item
)
},
(
item
:
string
)
=>
item
)
}
}
.
columnsTemplate
(
'
1fr 1fr 1fr 1fr
'
)
.
columnsTemplate
(
'
1fr 1fr 1fr 1fr
'
)
.
columnsGap
(
0
)
.
columnsGap
(
0
)
...
@@ -41,17 +41,17 @@ struct AspectRatioExample {
...
@@ -41,17 +41,17 @@ struct AspectRatioExample {
```
typescript
```
typescript
@
Entry
@
Entry
@
Component
@
Component
struct
AspectRatioExample
{
struct
AspectRatioExample
11
{
@
State
children
:
Number
[]
=
Array
.
from
(
Array
(
900
),
(
v
,
k
)
=>
k
);
@
State
children
:
Number
[]
=
Array
.
from
(
Array
(
900
),
(
v
,
k
)
=>
k
);
build
()
{
build
()
{
Scroll
()
{
Scroll
()
{
Grid
()
{
Grid
()
{
ForEach
(
this
.
children
,
(
item
)
=>
{
ForEach
(
this
.
children
,
(
item
:
Number
[]
)
=>
{
GridItem
()
{
GridItem
()
{
Text
(
item
.
toString
())
Text
(
item
.
toString
())
}
}
},
item
=>
item
)
},
(
item
:
string
)
=>
item
)
}
}
.
columnsTemplate
(
'
1fr 1fr 1fr 1fr
'
)
.
columnsTemplate
(
'
1fr 1fr 1fr 1fr
'
)
.
columnsGap
(
0
)
.
columnsGap
(
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录