From 95122c7d6a2a40a6af0d3a157c7993851b8b4d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=BF=E6=96=87=E5=B9=BF?= Date: Fri, 1 Sep 2023 02:38:51 +0000 Subject: [PATCH] update zh-cn/application-dev/quick-start/arkts-state.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 耿文广 --- zh-cn/application-dev/quick-start/arkts-state.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/quick-start/arkts-state.md b/zh-cn/application-dev/quick-start/arkts-state.md index c1fd5dd5cd..d0965be247 100644 --- a/zh-cn/application-dev/quick-start/arkts-state.md +++ b/zh-cn/application-dev/quick-start/arkts-state.md @@ -296,5 +296,14 @@ struct MyComponent { 2. 对于\@State来说,命名参数机制传递的值并不是必选的,如果没有命名参数传值,则使用本地初始化的默认值: ```ts - MyComponent({ count: 1, increaseBy: 2 }) +class C1 { + public count:number; + public increaseBy:number; + constructor(count: number, increaseBy:number) { + this.count = count; + this.increaseBy = increaseBy; + } +} +let obj = new C1(1, 2) +MyComponent(obj) ``` -- GitLab