From 95eaafda9a472bfdd5b06b2b1ed938f6bf1c5f2b Mon Sep 17 00:00:00 2001 From: Bo Jiang Date: Tue, 27 Jun 2023 07:45:40 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E5=88=99add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bo Jiang --- .../OpenHarmony_4.0.7.2/changelogs-arkui.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 zh-cn/release-notes/changelogs/OpenHarmony_4.0.7.2/changelogs-arkui.md diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.7.2/changelogs-arkui.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.7.2/changelogs-arkui.md new file mode 100644 index 0000000000..07407c0a12 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.7.2/changelogs-arkui.md @@ -0,0 +1,60 @@ +# arkui子系统ChangeLog + +### UI范式装饰器使用限制 + +#### 1.组件装饰器使用限制 + +组件装饰器@Component、@Entry、 @Preview和@CustomDialog 不允许装饰除了struct组件之外其他组件。 + +**示例:** + +``` +@Component + // ERROR:The '@Component' decorator can only be used with 'struct'. +class Index { + build() { + } +} +``` + +**变更影响** + +如果组件装饰器@Component、@Entry、 @Preview和@CustomDialog 没有装饰struct组件,编译报错。 + +**关键的接口/组件变更** + +不涉及。 + +**适配指导** + +组件装饰器@Component、@Entry、 @Preview和@CustomDialog修饰的其他的组件变成修饰struct组件。 + +#### 2.组件成员变量装饰器使用限制 + +组件成员变量装饰器@State、@Prop、@Link、@Provide、@Consume、@ObjectLink、@StorageLink、@StorageProp、@LocalStorageLink、@LocalStorageProp、@Watch、@BuilderParam只能装饰struct组件的成员变量。 + +**示例:** + +``` +@Component +class Index { + // ERROR: The '@State' decorator can only be used with 'struct'. + @State message: string = 'Hello world' + + build() { + + } +} +``` + +**变更影响** + +如果上述提到的组件成员变量装饰器没有装饰struct组件的成员变量,编译报错。 + +**关键的接口/组件变更** + +不涉及 + +**适配指导** + +组件成员变量装饰器如果装饰了非struct组件成员变量,请将装饰组件成员变量组件变成'struct'组件。 \ No newline at end of file -- GitLab