From c7ddb0a7c2a45e3db3fd997663ecc3954f1bbba7 Mon Sep 17 00:00:00 2001 From: g00657522 Date: Thu, 6 Feb 2025 11:33:00 +0300 Subject: [PATCH 1/2] better demo --- arkoala-arkts/arkui/src/sts/arkui.sts | 11 ++++++++--- arkoala-arkts/user/src/sts/hello.sts | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arkoala-arkts/arkui/src/sts/arkui.sts b/arkoala-arkts/arkui/src/sts/arkui.sts index 06e96582c..87c81e34f 100644 --- a/arkoala-arkts/arkui/src/sts/arkui.sts +++ b/arkoala-arkts/arkui/src/sts/arkui.sts @@ -90,7 +90,9 @@ export class Button extends CommonMethod { options?: ButtonOptions|string, //content?: () => void ): Button { - throw new Error("This method should only be called through a @BuilderLambda redirect") + //throw new Error("This method should only be called through a @BuilderLambda redirect") + console.log("Button") + return factory() } static instantiateImpl( @@ -117,7 +119,10 @@ export class Text extends CommonMethod { options?: TextOptions|string, //content?: () => void ): Text { - throw new Error("This method should only be called through a @BuilderLambda redirect") + //throw new Error("This method should only be called through a @BuilderLambda redirect") + + console.log("Text") + return factory() } // TODO: the second argument will be gone after hte plugin is improved @@ -134,7 +139,7 @@ export class Text extends CommonMethod { } fontColor(value: Color): this { - console.log(value) + console.log(Color[value]) return this } } diff --git a/arkoala-arkts/user/src/sts/hello.sts b/arkoala-arkts/user/src/sts/hello.sts index 6a41db84c..1b44ae38e 100644 --- a/arkoala-arkts/user/src/sts/hello.sts +++ b/arkoala-arkts/user/src/sts/hello.sts @@ -22,7 +22,7 @@ struct MyStateSample { } export class ArkUIEntry { - static mandatory: boolean = ArkUIEntry.run() + // static mandatory: boolean = ArkUIEntry.run() static run(): boolean { console.log("About to invoke the struct") // The proper call fails because of a compiler frontend bug. -- Gitee From 53975e444be5a39eb9a939c8feb96e6e9ecb9ee5 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Thu, 6 Feb 2025 12:24:28 +0300 Subject: [PATCH 2/2] more Signed-off-by: Alexander Gorshenev --- arkoala-arkts/arkui/src/sts/arkui.sts | 6 +++++- arkoala-arkts/user/src/sts/hello.sts | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arkoala-arkts/arkui/src/sts/arkui.sts b/arkoala-arkts/arkui/src/sts/arkui.sts index 87c81e34f..69aa97ece 100644 --- a/arkoala-arkts/arkui/src/sts/arkui.sts +++ b/arkoala-arkts/arkui/src/sts/arkui.sts @@ -52,6 +52,10 @@ export class CommonMethod { console.log(`.width(${value})`) return this } + height(value: number): this { + console.log(`.height(${value})`) + return this + } } // An attempt to put down a component @@ -139,7 +143,7 @@ export class Text extends CommonMethod { } fontColor(value: Color): this { - console.log(Color[value]) + console.log("\.fontColor(", Color[value], ")") return this } } diff --git a/arkoala-arkts/user/src/sts/hello.sts b/arkoala-arkts/user/src/sts/hello.sts index 1b44ae38e..2bf90253c 100644 --- a/arkoala-arkts/user/src/sts/hello.sts +++ b/arkoala-arkts/user/src/sts/hello.sts @@ -17,7 +17,10 @@ struct MyStateSample { this.color = Color.Red }) - }).width(100) + }) + .width(100) + .height(300) + } } -- Gitee