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.…