未验证 提交 28cedb82 编写于 作者: O openharmony_ci 提交者: Gitee

!23893 Rectify the arkts syntax 4

Merge pull request !23893 from 189******51/master
......@@ -21,14 +21,14 @@
```ts
@Builder MyBuilderFunction({ ... })
@Builder MyBuilderFunction() { ... }
```
使用方法:
```ts
this.MyBuilderFunction({ ... })
this.MyBuilderFunction() { ... }
```
- 允许在自定义组件内定义一个或多个自定义构建函数,该函数被认为是该组件的私有、特殊类型的成员函数。
......@@ -44,7 +44,7 @@ this.MyBuilderFunction({ ... })
```ts
@Builder function MyGlobalBuilderFunction({ ... })
@Builder function MyGlobalBuilderFunction() { ... }
```
使用方法:
......@@ -82,7 +82,7 @@ class ABuilderParam {
paramB1: string = ''
}
ABuilder($$ : ABuilderParam);
@Builder function ABuilder($$ : ABuilderParam) {...}
```
......
......@@ -116,13 +116,13 @@ Column() {
})
```
- 使用匿名函数表达式配置组件的事件方法,要求使用bind,以确保函数体中的this指向当前组件
- 使用匿名函数表达式配置组件的事件方法,要求使用“() => {...}”,以确保函数与组件绑定,同时符合ArtTS语法规范
```ts
Button('add counter')
.onClick(function(){
.onClick(() => {
this.counter += 2;
}.bind(this))
})
```
- 使用组件的成员函数配置组件的事件方法。
......@@ -133,7 +133,7 @@ Column() {
}
...
Button('add counter')
.onClick(this.myClickHandler.bind(this))
.onClick(this.myClickHandler)
```
......
......@@ -202,7 +202,7 @@ class MyDataSource extends BasicDataSource {
@Component
struct MyComponent {
aboutToAppear() {
for (var i = 100; i >= 80; i--) {
for (let i = 100; i >= 80; i--) {
this.data.pushData(`Hello ${i}`)
}
}
......@@ -223,7 +223,7 @@ struct MyComponent {
.onClick(() => {
this.data.pushData(`Hello ${this.data.totalCount()}`);
})
}, item => item)
}, (item: string) => item)
}.cachedCount(5)
}
}
......
......@@ -17,14 +17,15 @@
```ts
import installer from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base';
let bundleName = 'com.ohos.demo';
let installParam: installer.InstallParam = {
userId: 100
};
try {
installer.getBundleInstaller().then(data => {
data.uninstall(bundleName, installParam, err => {
installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
data.uninstall(bundleName, installParam, (err: BusinessError) => {
if (err) {
console.error('uninstall failed:' + err.message);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册