Menu

Post image 1
Post image 2
1 / 2
0

Passing parameters from a struct decorated with @ComponentV2 to a custom dialog decorated with @CustomDialog fails

DEV Community·HarmonyOS·26 days ago
#qTIdLnbW
Reading 0:00
15s threshold

Read the original article:Passing parameters from a struct decorated with @ComponentV2 to a custom dialog decorated with @CustomDialog fails Problem Description In the @ComponentV2 component, data cannot be directly passed to the @CustomDialog component. The problematic code is as follows: @ ComponentV2 export struct Page { @ Local selectIndex : number = 0 ; dialogController : CustomDialogController | null = new CustomDialogController ({ builder : AccountSafeDialog ({ selectIndex : this . selectIndex , }), }) // ... } // Define pop-up window @ CustomDialog export struct AccountSafeDialog { controller ?: CustomDialogController ; @ Link selectIndex : number ; // ... } Enter fullscreen mode Exit fullscreen mode Background Knowledge The @ComponentV2 decorator is a custom component decorator used in conjunction with V2 state variables. Variables decorated with the @Link decorator share the same value as the data source in their parent component.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More