提交 b5e8941b 编写于 作者: S sqsyqqy

ArkTS告警处理

Signed-off-by: Nsqsyqqy <sunqi57@huawei.com>
上级 2bbe7e3e
此差异已折叠。
...@@ -73,8 +73,8 @@ aboutToAppear函数会在创建自定义组件实例后,页面绘制之前执 ...@@ -73,8 +73,8 @@ aboutToAppear函数会在创建自定义组件实例后,页面绘制之前执
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State private text: string = undefined; @State private text: string = "";
private count: number = undefined; private count: number = 0;
aboutToAppear() { aboutToAppear() {
this.computeTaskAsync(); // 异步任务 this.computeTaskAsync(); // 异步任务
......
...@@ -107,7 +107,7 @@ struct AspectRatioExample { ...@@ -107,7 +107,7 @@ struct AspectRatioExample {
@Component @Component
struct AspectRatioExample { struct AspectRatioExample {
@State private children: string[] = ['1', '2', '3', '4', '5', '6']; @State private children: string[] = ['1', '2', '3', '4', '5', '6'];
private count: number = undefined; private count: number = 0;
aboutToAppear() { aboutToAppear() {
this.computeTaskAsync(); // 调用异步运算函数 this.computeTaskAsync(); // 调用异步运算函数
......
...@@ -17,8 +17,8 @@ struct AttrAnimationExample { ...@@ -17,8 +17,8 @@ struct AttrAnimationExample {
computeSize() { computeSize() {
let duration = 2000 let duration = 2000
let period = 16 let period = 16
let widthSizeEnd = undefined let widthSizeEnd = 0
let heightSizeEnd = undefined let heightSizeEnd = 0
if (this.flag) { if (this.flag) {
widthSizeEnd = 100 widthSizeEnd = 100
heightSizeEnd = 50 heightSizeEnd = 50
...@@ -67,7 +67,7 @@ struct AttrAnimationExample { ...@@ -67,7 +67,7 @@ struct AttrAnimationExample {
build() { build() {
Column() { Column() {
Button('click me') Button('click me')
.onClick((event: ClickEvent) => { .onClick((event?: ClickEvent | undefined) => {
if (this.flag) { if (this.flag) {
this.widthSize = 100 this.widthSize = 100
this.heightSize = 50 this.heightSize = 50
...@@ -107,7 +107,7 @@ struct AnimateToExample { ...@@ -107,7 +107,7 @@ struct AnimateToExample {
build() { build() {
Column() { Column() {
Button('click me') Button('click me')
.onClick((event: ClickEvent) => { .onClick((event?: ClickEvent | undefined) => {
if (this.flag) { if (this.flag) {
animateTo({ animateTo({
duration: 2000, // 动画时长 duration: 2000, // 动画时长
......
...@@ -39,7 +39,6 @@ struct AspectRatioExample { ...@@ -39,7 +39,6 @@ struct AspectRatioExample {
建议:通过减少冗余的Stack容器嵌套,每个GridItem的组件数比上面少了3个,缩短了组件刷新与渲染耗时。 建议:通过减少冗余的Stack容器嵌套,每个GridItem的组件数比上面少了3个,缩短了组件刷新与渲染耗时。
```typescript ```typescript
// xxx.ets
@Entry @Entry
@Component @Component
struct AspectRatioExample { struct AspectRatioExample {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册