未验证 提交 54c73c25 编写于 作者: O openharmony_ci 提交者: Gitee

!23567 Rectify the arkts syntax of qs

Merge pull request !23567 from 189******51/master
...@@ -101,7 +101,7 @@ class PointVector extends Array<Point> implements AnimatableArithmetic<PointVect ...@@ -101,7 +101,7 @@ class PointVector extends Array<Point> implements AnimatableArithmetic<PointVect
let result = new PointVector([]) let result = new PointVector([])
const len = Math.min(this.length, rhs.length) const len = Math.min(this.length, rhs.length)
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
result.push(this[i].plus(rhs[i])) result.push((this as Array<Point>)[i].plus((rhs as Array<Point>)[i]))
} }
return result return result
} }
...@@ -109,14 +109,14 @@ class PointVector extends Array<Point> implements AnimatableArithmetic<PointVect ...@@ -109,14 +109,14 @@ class PointVector extends Array<Point> implements AnimatableArithmetic<PointVect
let result = new PointVector([]) let result = new PointVector([])
const len = Math.min(this.length, rhs.length) const len = Math.min(this.length, rhs.length)
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
result.push(this[i].subtract(rhs[i])) result.push((this as Array<Point>)[i].subtract((rhs as Array<Point>)[i]))
} }
return result return result
} }
multiply(scale: number): PointVector { multiply(scale: number): PointVector {
let result = new PointVector([]) let result = new PointVector([])
for (let i = 0; i < this.length; i++) { for (let i = 0; i < this.length; i++) {
result.push(this[i].multiply(scale)) result.push((this as Array<Point>)[i].multiply(scale))
} }
return result return result
} }
...@@ -125,14 +125,14 @@ class PointVector extends Array<Point> implements AnimatableArithmetic<PointVect ...@@ -125,14 +125,14 @@ class PointVector extends Array<Point> implements AnimatableArithmetic<PointVect
return false return false
} }
for (let i = 0; i < this.length; i++) { for (let i = 0; i < this.length; i++) {
if (!this[i].equals(rhs[i])) { if (!(this as Array<Point>)[i].equals((rhs as Array<Point>)[i])) {
return false return false
} }
} }
return true return true
} }
get():Array<[x: number, y: number]> { get(): Array<Object[]> {
let result = [] let result: Array<Object[]> = []
this.forEach(p => result.push([p.x, p.y])) this.forEach(p => result.push([p.x, p.y]))
return result return result
} }
......
...@@ -144,21 +144,22 @@ AppStorage是单例,它的所有API都是静态的,使用方法类似于中L ...@@ -144,21 +144,22 @@ AppStorage是单例,它的所有API都是静态的,使用方法类似于中L
```ts ```ts
AppStorage.SetOrCreate('PropA', 47); AppStorage.SetOrCreate('PropA', 47);
let storage: LocalStorage = new LocalStorage({ 'PropA': 17 }); let storage: LocalStorage = new LocalStorage();
let propA: number = AppStorage.Get('PropA') // propA in AppStorage == 47, propA in LocalStorage == 17 storage['PropA'] = 17;
var link1: SubscribedAbstractProperty<number> = AppStorage.Link('PropA'); // link1.get() == 47 let propA: number | undefined = AppStorage.Get('PropA') // propA in AppStorage == 47, propA in LocalStorage == 17
var link2: SubscribedAbstractProperty<number> = AppStorage.Link('PropA'); // link2.get() == 47 let link1: SubscribedAbstractProperty<number> = AppStorage.Link('PropA'); // link1.get() == 47
var prop: SubscribedAbstractProperty<number> = AppStorage.Prop('PropA'); // prop.get() = 47 let link2: SubscribedAbstractProperty<number> = AppStorage.Link('PropA'); // link2.get() == 47
let prop: SubscribedAbstractProperty<number> = AppStorage.Prop('PropA'); // prop.get() = 47
link1.set(48); // two-way sync: link1.get() == link2.get() == prop.get() == 48 link1.set(48); // two-way sync: link1.get() == link2.get() == prop.get() == 48
prop.set(1); // one-way sync: prop.get()=1; but link1.get() == link2.get() == 48 prop.set(1); // one-way sync: prop.get()=1; but link1.get() == link2.get() == 48
link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49 link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49
storage.get('PropA') // == 17 storage.get<number>('PropA') // == 17
storage.set('PropA', 101); storage.set('PropA', 101);
storage.get('PropA') // == 101 storage.get<number>('PropA') // == 101
AppStorage.Get('PropA') // == 49 AppStorage.Get<number>('PropA') // == 49
link1.get() // == 49 link1.get() // == 49
link2.get() // == 49 link2.get() // == 49
prop.get() // == 49 prop.get() // == 49
...@@ -172,7 +173,8 @@ prop.get() // == 49 ...@@ -172,7 +173,8 @@ prop.get() // == 49
```ts ```ts
AppStorage.SetOrCreate('PropA', 47); AppStorage.SetOrCreate('PropA', 47);
let storage = new LocalStorage({ 'PropA': 48 }); let storage = new LocalStorage();
storage['PropA'] = 48;
@Entry(storage) @Entry(storage)
@Component @Component
...@@ -242,8 +244,13 @@ struct Gallery2 { ...@@ -242,8 +244,13 @@ struct Gallery2 {
export struct TapImage { export struct TapImage {
@StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1; @StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1;
@State tapColor: Color = Color.Black; @State tapColor: Color = Color.Black;
private index: number; private index: number = 0;
private uri: Resource; private uri: Resource = {
id: 0,
type: 0,
moduleName: "",
bundleName: ""
};
// 判断是否被选中 // 判断是否被选中
onTapIndexChange() { onTapIndexChange() {
...@@ -313,9 +320,9 @@ struct Gallery2 { ...@@ -313,9 +320,9 @@ struct Gallery2 {
if (this.preIndex === item.id) { if (this.preIndex === item.id) {
return return
} }
var innerEvent = { eventId: item.id } let innerEvent: emitter.InnerEvent = { eventId: item.id }
// 选中态:黑变红 // 选中态:黑变红
var eventData = { let eventData: emitter.EventData = {
data: { data: {
"colorTag": 1 "colorTag": 1
} }
...@@ -324,9 +331,9 @@ struct Gallery2 { ...@@ -324,9 +331,9 @@ struct Gallery2 {
if (this.preIndex != -1) { if (this.preIndex != -1) {
console.info(`preIndex: ${this.preIndex}, index: ${item.id}, black`) console.info(`preIndex: ${this.preIndex}, index: ${item.id}, black`)
var innerEvent = { eventId: this.preIndex } let innerEvent: emitter.InnerEvent = { eventId: this.preIndex }
// 取消选中态:红变黑 // 取消选中态:红变黑
var eventData = { let eventData: emitter.EventData = {
data: { data: {
"colorTag": 0 "colorTag": 0
} }
...@@ -335,7 +342,6 @@ struct Gallery2 { ...@@ -335,7 +342,6 @@ struct Gallery2 {
} }
this.preIndex = item.id this.preIndex = item.id
}) })
}, (item: ViewData) => JSON.stringify(item)) }, (item: ViewData) => JSON.stringify(item))
}.columnsTemplate('1fr 1fr') }.columnsTemplate('1fr 1fr')
} }
...@@ -346,17 +352,26 @@ struct Gallery2 { ...@@ -346,17 +352,26 @@ struct Gallery2 {
@Component @Component
export struct TapImage { export struct TapImage {
@State tapColor: Color = Color.Black; @State tapColor: Color = Color.Black;
private index: number; private index: number = 0;
private uri: Resource; private uri: Resource = {
id: 0,
type: 0,
moduleName: "",
bundleName: ""
};
onTapIndexChange(colorTag: emitter.EventData) { onTapIndexChange(colorTag: emitter.EventData) {
this.tapColor = colorTag.data.colorTag ? Color.Red : Color.Black if (colorTag.data != null) {
this.tapColor = colorTag.data.colorTag ? Color.Red : Color.Black
}
} }
aboutToAppear() { aboutToAppear() {
//定义事件ID //定义事件ID
var innerEvent = { eventId: this.index } let innerEvent: emitter.InnerEvent = { eventId: this.index }
emitter.on(innerEvent, this.onTapIndexChange.bind(this)) emitter.on(innerEvent, data => {
this.onTapIndexChange(data)
})
} }
build() { build() {
...@@ -414,8 +429,13 @@ struct Gallery2 { ...@@ -414,8 +429,13 @@ struct Gallery2 {
export struct TapImage { export struct TapImage {
@StorageLink('tapIndex') tapIndex: number = -1; @StorageLink('tapIndex') tapIndex: number = -1;
@State tapColor: Color = Color.Black; @State tapColor: Color = Color.Black;
private index: number; private index: number = 0;
private uri: Resource; private uri: Resource = {
id: 0,
type: 0,
moduleName: "",
bundleName: ""
};
build() { build() {
Column() { Column() {
......
...@@ -35,7 +35,7 @@ Environment是ArkUI框架在应用程序启动时创建的单例对象。它为A ...@@ -35,7 +35,7 @@ Environment是ArkUI框架在应用程序启动时创建的单例对象。它为A
```ts ```ts
// 将设备languageCode存入AppStorage中 // 将设备languageCode存入AppStorage中
Environment.EnvProp('languageCode', 'en'); Environment.EnvProp('languageCode', 'en');
let enable = AppStorage.Get('languageCode'); let enable: undefined = AppStorage.Get<undefined>('languageCode');
@Entry @Entry
@Component @Component
......
...@@ -227,10 +227,10 @@ struct Parent { ...@@ -227,10 +227,10 @@ struct Parent {
Column() { Column() {
Child({ items: $arr }) Child({ items: $arr })
ForEach(this.arr, ForEach(this.arr,
item => { (item: void) => {
Text(`${item}`) Text(`${item}`)
}, },
item => item.toString() (item: ForEachInterface) => item.toString()
) )
} }
} }
......
...@@ -191,36 +191,37 @@ link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49 ...@@ -191,36 +191,37 @@ link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49
- \@LocalStorageLink绑定LocalStorage对给定的属性,建立双向数据同步。 - \@LocalStorageLink绑定LocalStorage对给定的属性,建立双向数据同步。
```ts ```ts
// 创建新实例并使用给定对象初始化 // 创建新实例并使用给定对象初始化
let storage = new LocalStorage({ 'PropA': 47 }); let storage = new LocalStorage();
storage['PropA'] = 47;
@Component
struct Child { @Component
// @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定 struct Child {
@LocalStorageLink('PropA') storLink2: number = 1; // @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定
@LocalStorageLink('PropA') storLink2: number = 1;
build() {
Button(`Child from LocalStorage ${this.storLink2}`) build() {
// 更改将同步至LocalStorage中的'ProA'以及Parent.storLink1 Button(`Child from LocalStorage ${this.storLink2}`)
.onClick(() => this.storLink2 += 1) // 更改将同步至LocalStorage中的'ProA'以及Parent.storLink1
} .onClick(() => this.storLink2 += 1)
} }
// 使LocalStorage可从@Component组件访问 }
@Entry(storage) // 使LocalStorage可从@Component组件访问
@Component @Entry(storage)
struct CompA { @Component
// @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定 struct CompA {
@LocalStorageLink('PropA') storLink1: number = 1; // @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定
@LocalStorageLink('PropA') storLink1: number = 1;
build() {
Column({ space: 15 }) { build() {
Button(`Parent from LocalStorage ${this.storLink1}`) // initial value from LocalStorage will be 47, because 'PropA' initialized already Column({ space: 15 }) {
.onClick(() => this.storLink1 += 1) Button(`Parent from LocalStorage ${this.storLink1}`) // initial value from LocalStorage will be 47, because 'PropA' initialized already
// @Component子组件自动获得对CompA LocalStorage实例的访问权限。 .onClick(() => this.storLink1 += 1)
Child() // @Component子组件自动获得对CompA LocalStorage实例的访问权限。
} Child()
} }
} }
}
``` ```
...@@ -233,37 +234,39 @@ link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49 ...@@ -233,37 +234,39 @@ link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49
- Child组件中,Text绑定的storProp2 依旧显示47。 - Child组件中,Text绑定的storProp2 依旧显示47。
```ts ```ts
// 创建新实例并使用给定对象初始化 // 创建新实例并使用给定对象初始化
let storage = new LocalStorage({ 'PropA': 47 }); let storage = new LocalStorage();
// 使LocalStorage可从@Component组件访问 storage['PropA'] = 47;
@Entry(storage)
@Component // 使LocalStorage可从@Component组件访问
struct CompA { @Entry(storage)
// @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定 @Component
@LocalStorageProp('PropA') storProp1: number = 1; struct CompA {
// @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定
build() { @LocalStorageProp('PropA') storProp1: number = 1;
Column({ space: 15 }) {
// 点击后从47开始加1,只改变当前组件显示的storProp1,不会同步到LocalStorage中 build() {
Button(`Parent from LocalStorage ${this.storProp1}`) Column({ space: 15 }) {
.onClick(() => this.storProp1 += 1) // 点击后从47开始加1,只改变当前组件显示的storProp1,不会同步到LocalStorage中
Child() Button(`Parent from LocalStorage ${this.storProp1}`)
} .onClick(() => this.storProp1 += 1)
Child()
} }
} }
}
@Component @Component
struct Child { struct Child {
// @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定 // @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定
@LocalStorageProp('PropA') storProp2: number = 2; @LocalStorageProp('PropA') storProp2: number = 2;
build() { build() {
Column({ space: 15 }) { Column({ space: 15 }) {
// 当CompA改变时,当前storProp2不会改变,显示47 // 当CompA改变时,当前storProp2不会改变,显示47
Text(`Parent from LocalStorage ${this.storProp2}`) Text(`Parent from LocalStorage ${this.storProp2}`)
}
} }
} }
}
``` ```
...@@ -274,9 +277,10 @@ link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49 ...@@ -274,9 +277,10 @@ link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49
```ts ```ts
// 构造LocalStorage实例 // 构造LocalStorage实例
let storage = new LocalStorage({ 'PropA': 47 }); let storage = new LocalStorage();
storage['PropA'] = 47;
// 调用link9+接口构造'PropA'的双向同步数据,linkToPropA 是全局变量 // 调用link9+接口构造'PropA'的双向同步数据,linkToPropA 是全局变量
let linkToPropA = storage.link('PropA'); let linkToPropA = storage.link<number>('PropA');
@Entry(storage) @Entry(storage)
@Component @Component
...@@ -288,7 +292,7 @@ struct CompA { ...@@ -288,7 +292,7 @@ struct CompA {
build() { build() {
Column() { Column() {
Text(`incr @LocalStorageLink variable`) Text(`incr @LocalStorageLink variable`)
// 点击“incr @LocalStorageLink variable”,this.storLink加1,改变同步回storage,全局变量linkToPropA也会同步改变 // 点击“incr @LocalStorageLink variable”,this.storLink加1,改变同步回storage,全局变量linkToPropA也会同步改变
.onClick(() => this.storLink += 1) .onClick(() => this.storLink += 1)
...@@ -388,11 +392,10 @@ import UIAbility from '@ohos.app.ability.UIAbility'; ...@@ -388,11 +392,10 @@ import UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window'; import window from '@ohos.window';
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
storage: LocalStorage = new LocalStorage({ storage: LocalStorage = new LocalStorage();
'PropA': 47
});
onWindowStageCreate(windowStage: window.WindowStage) { onWindowStageCreate(windowStage: window.WindowStage) {
this.storage['PropA'] = 47;
windowStage.loadContent('pages/Index', this.storage); windowStage.loadContent('pages/Index', this.storage);
} }
} }
......
...@@ -126,7 +126,7 @@ this.b.a.c = 5 ...@@ -126,7 +126,7 @@ this.b.a.c = 5
```ts ```ts
@Observed @Observed
class DateClass extends Date { class DateClass extends Date {
constructor(args: any) { constructor(args: number | string) {
super(args) super(args)
} }
} }
...@@ -343,10 +343,10 @@ struct ViewB { ...@@ -343,10 +343,10 @@ struct ViewB {
build() { build() {
Column() { Column() {
ForEach(this.arrA, ForEach(this.arrA,
(item) => { (item: ClassA) => {
ViewA({ label: `#${item.id}`, a: item }) ViewA({ label: `#${item.id}`, a: item })
}, },
(item) => item.id.toString() (item: ClassA) => item.id.toString()
) )
// 使用@State装饰的数组的数组项初始化@ObjectLink,其中数组项是被@Observed装饰的ClassA的实例 // 使用@State装饰的数组的数组项初始化@ObjectLink,其中数组项是被@Observed装饰的ClassA的实例
ViewA({ label: `ViewA this.arrA[first]`, a: this.arrA[0] }) ViewA({ label: `ViewA this.arrA[first]`, a: this.arrA[0] })
...@@ -419,11 +419,11 @@ struct ItemPage { ...@@ -419,11 +419,11 @@ struct ItemPage {
.width(100).height(100) .width(100).height(100)
ForEach(this.itemArr, ForEach(this.itemArr,
item => { (item: string | Resource) => {
Text(item) Text(item)
.width(100).height(100) .width(100).height(100)
}, },
item => item (item: string) => item
) )
} }
} }
...@@ -439,14 +439,14 @@ struct IndexPage { ...@@ -439,14 +439,14 @@ struct IndexPage {
ItemPage({ itemArr: this.arr[0] }) ItemPage({ itemArr: this.arr[0] })
ItemPage({ itemArr: this.arr[1] }) ItemPage({ itemArr: this.arr[1] })
ItemPage({ itemArr: this.arr[2] }) ItemPage({ itemArr: this.arr[2] })
Divider() Divider()
ForEach(this.arr, ForEach(this.arr,
itemArr => { (itemArr: StringArray) => {
ItemPage({ itemArr: itemArr }) ItemPage({ itemArr: itemArr })
}, },
itemArr => itemArr[0] (itemArr: string) => itemArr[0]
) )
Divider() Divider()
...@@ -454,7 +454,7 @@ struct IndexPage { ...@@ -454,7 +454,7 @@ struct IndexPage {
Button('update') Button('update')
.onClick(() => { .onClick(() => {
console.error('Update all items in arr'); console.error('Update all items in arr');
if (this.arr[0][0] !== undefined) { if ((this.arr[0] as Array<String>)[0] !== undefined) {
// 正常情况下需要有一个真实的ID来与ForEach一起使用,但此处没有 // 正常情况下需要有一个真实的ID来与ForEach一起使用,但此处没有
// 因此需要确保推送的字符串是唯一的。 // 因此需要确保推送的字符串是唯一的。
this.arr[0].push(`${this.arr[0].slice(-1).pop()}${this.arr[0].slice(-1).pop()}`); this.arr[0].push(`${this.arr[0].slice(-1).pop()}${this.arr[0].slice(-1).pop()}`);
......
...@@ -40,7 +40,7 @@ PersistentStorage和UIContext相关联,需要在[UIContext](../reference/apis/ ...@@ -40,7 +40,7 @@ PersistentStorage和UIContext相关联,需要在[UIContext](../reference/apis/
2. 在AppStorage获取对应属性: 2. 在AppStorage获取对应属性:
```ts ```ts
AppStorage.Get('aProp'); // returns 47 AppStorage.Get<number>('aProp'); // returns 47
``` ```
或在组件内部定义: 或在组件内部定义:
......
...@@ -118,7 +118,7 @@ this.title.push('3') ...@@ -118,7 +118,7 @@ this.title.push('3')
```ts ```ts
@Component @Component
struct DateComponent { struct DateComponent {
@Prop selectedDate: Date; @Prop selectedDate: Date = new Date('');
build() { build() {
Column() { Column() {
...@@ -198,7 +198,7 @@ ParentComponent的状态变量countDownStartValue的变化将重置CountDownComp ...@@ -198,7 +198,7 @@ ParentComponent的状态变量countDownStartValue的变化将重置CountDownComp
```ts ```ts
@Component @Component
struct CountDownComponent { struct CountDownComponent {
@Prop count: number; @Prop count: number = 0;
costOfOneAttempt: number = 1; costOfOneAttempt: number = 1;
build() { build() {
...@@ -370,7 +370,7 @@ class Book { ...@@ -370,7 +370,7 @@ class Book {
@Component @Component
struct ReaderComp { struct ReaderComp {
@Prop book: Book; @Prop book: Book = new Book("", 0);
build() { build() {
Row() { Row() {
...@@ -419,7 +419,7 @@ class Book { ...@@ -419,7 +419,7 @@ class Book {
@Component @Component
struct ReaderComp { struct ReaderComp {
@Prop book: Book; @Prop book: Book = new Book("", 1);
build() { build() {
Row() { Row() {
...@@ -442,10 +442,10 @@ struct Library { ...@@ -442,10 +442,10 @@ struct Library {
ReaderComp({ book: this.allBooks[2] }) ReaderComp({ book: this.allBooks[2] })
Divider() Divider()
Text('Books on loaan to a reader') Text('Books on loaan to a reader')
ForEach(this.allBooks, book => { ForEach(this.allBooks, (book: Book) => {
ReaderComp({ book: book }) ReaderComp({ book: book })
}, },
book => book.id) (book: Book) => book.id.toString())
Button('Add new') Button('Add new')
.onClick(() => { .onClick(() => {
this.allBooks.push(new Book("The C++ Standard Library", 512)); this.allBooks.push(new Book("The C++ Standard Library", 512));
...@@ -497,7 +497,7 @@ class Book { ...@@ -497,7 +497,7 @@ class Book {
```ts ```ts
@Component @Component
struct MyComponent { struct MyComponent {
@Prop customCounter: number; @Prop customCounter: number = 0;
@Prop customCounter2: number = 5; @Prop customCounter2: number = 5;
build() { build() {
...@@ -579,7 +579,6 @@ class ClassB { ...@@ -579,7 +579,6 @@ class ClassB {
以下组件层次结构呈现的是@Prop嵌套场景的数据结构。 以下组件层次结构呈现的是@Prop嵌套场景的数据结构。
```ts ```ts
@Entry @Entry
@Component @Component
struct Parent { struct Parent {
...@@ -588,10 +587,10 @@ struct Parent { ...@@ -588,10 +587,10 @@ struct Parent {
build() { build() {
Column() { Column() {
Button('change') Button('change')
.onClick(() => { .onClick(() => {
this.votes.name = "aaaaa" this.votes.name = "aaaaa"
this.votes.a.title = "wwwww" this.votes.a.title = "wwwww"
}) })
Child({ vote: this.votes }) Child({ vote: this.votes })
} }
...@@ -600,33 +599,33 @@ struct Parent { ...@@ -600,33 +599,33 @@ struct Parent {
@Component @Component
struct Child { struct Child {
@Prop vote: ClassB @Prop vote: ClassB = new ClassB('', new ClassA(''));
build() { build() {
Column() { Column() {
Text(this.vote.name).fontSize(36).fontColor(Color.Red).margin(50) Text(this.vote.name).fontSize(36).fontColor(Color.Red).margin(50)
.onClick(() => { .onClick(() => {
this.vote.name = 'Bye' this.vote.name = 'Bye'
}) })
Text(this.vote.a.title).fontSize(36).fontColor(Color.Blue) Text(this.vote.a.title).fontSize(36).fontColor(Color.Blue)
.onClick(() => { .onClick(() => {
this.vote.a.title = "openHarmony" this.vote.a.title = "openHarmony"
}) })
Child1({vote1:this.vote.a}) Child1({vote1:this.vote.a})
} }
} }
} }
@Component @Component
struct Child1 { struct Child1 {
@Prop vote1: ClassA @Prop vote1: ClassA = new ClassA('');
build() { build() {
Column() { Column() {
Text(this.vote1.title).fontSize(36).fontColor(Color.Red).margin(50) Text(this.vote1.title).fontSize(36).fontColor(Color.Red).margin(50)
.onClick(() => { .onClick(() => {
this.vote1.title = 'Bye Bye' this.vote1.title = 'Bye Bye'
}) })
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册