From b5e8941bca3b6fad2b3f386bfa876b0e76b37bc7 Mon Sep 17 00:00:00 2001 From: sqsyqqy Date: Mon, 4 Sep 2023 16:06:38 +0800 Subject: [PATCH] =?UTF-8?q?ArkTS=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sqsyqqy --- .../performance/.idea/workspace.xml | 436 ++++++++++++++++++ .../improve-application-cold-start-speed.md | 4 +- .../improve-application-response.md | 2 +- .../reduce-animation-frame-loss.md | 8 +- .../reduce-view-nesting-levels.md | 1 - 5 files changed, 443 insertions(+), 8 deletions(-) create mode 100644 zh-cn/application-dev/performance/.idea/workspace.xml diff --git a/zh-cn/application-dev/performance/.idea/workspace.xml b/zh-cn/application-dev/performance/.idea/workspace.xml new file mode 100644 index 0000000000..5497277bc7 --- /dev/null +++ b/zh-cn/application-dev/performance/.idea/workspace.xml @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md index 9a8575e537..5c74b68967 100644 --- a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md +++ b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md @@ -73,8 +73,8 @@ aboutToAppear函数会在创建自定义组件实例后,页面绘制之前执 @Entry @Component struct Index { - @State private text: string = undefined; - private count: number = undefined; + @State private text: string = ""; + private count: number = 0; aboutToAppear() { this.computeTaskAsync(); // 异步任务 diff --git a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md index 4762a0b23c..98466b306c 100644 --- a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md +++ b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md @@ -107,7 +107,7 @@ struct AspectRatioExample { @Component struct AspectRatioExample { @State private children: string[] = ['1', '2', '3', '4', '5', '6']; - private count: number = undefined; + private count: number = 0; aboutToAppear() { this.computeTaskAsync(); // 调用异步运算函数 diff --git a/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md b/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md index 2aed2e3f3f..8e677d2e54 100644 --- a/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md +++ b/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md @@ -17,8 +17,8 @@ struct AttrAnimationExample { computeSize() { let duration = 2000 let period = 16 - let widthSizeEnd = undefined - let heightSizeEnd = undefined + let widthSizeEnd = 0 + let heightSizeEnd = 0 if (this.flag) { widthSizeEnd = 100 heightSizeEnd = 50 @@ -67,7 +67,7 @@ struct AttrAnimationExample { build() { Column() { Button('click me') - .onClick((event: ClickEvent) => { + .onClick((event?: ClickEvent | undefined) => { if (this.flag) { this.widthSize = 100 this.heightSize = 50 @@ -107,7 +107,7 @@ struct AnimateToExample { build() { Column() { Button('click me') - .onClick((event: ClickEvent) => { + .onClick((event?: ClickEvent | undefined) => { if (this.flag) { animateTo({ duration: 2000, // 动画时长 diff --git a/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md b/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md index bfe962fc77..d2df662443 100644 --- a/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md +++ b/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md @@ -39,7 +39,6 @@ struct AspectRatioExample { 建议:通过减少冗余的Stack容器嵌套,每个GridItem的组件数比上面少了3个,缩短了组件刷新与渲染耗时。 ```typescript -// xxx.ets @Entry @Component struct AspectRatioExample { -- GitLab