1# ArkUI (ArkTS) Development 2 3## How do I use router to implement page redirection in the stage model? 4 5Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 6 71. To implement page redirection through **router**, add all redirected-to pages to the pages list in the **main_pages.json** file. 8 92. Page routing APIs in **router** can be invoked only after page rendering is complete. Do not call these APIs in **onInit** or **onReady** when the page is still in the rendering phase. 10 11Reference: [Page Routing](../reference/apis/js-apis-router.md) 12 13## Will a page pushed into the stack through router.push be reclaimed? 14 15Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 16 17After being pushed to the stack through **router.push**, a page can be reclaimed only when it is popped from the stack through **router.back**. 18 19## How do I position a container component to the bottom of the screen? 20 21Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 22 23Create a **<Stack\>** component, and set the target container at the bottom of the **<Stack\>** component. 24 25Example: 26 27``` 28build() { 29 Stack({alignContent : Alignment.Bottom}) { 30 // The container is at the bottom. 31 Stack() { 32 Column() 33 .width('100%') 34 .height('100%') 35 .backgroundColor(Color.Yellow) 36 } 37 .width('100%') 38 .height('10%') 39 } 40 .width('100%') 41 .height('100%') 42 .backgroundColor('rgba(255,255,255, 0)') 43} 44``` 45 46## Can CustomDialog be used in TypeScript files? 47 48Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 49 50No. **CustomDialog** can be used only on ArkTS pages. 51 52Reference: [Custom Dialog Box](../reference/arkui-ts/ts-methods-custom-dialog-box.md) 53 54## How do I transfer variables in CustomDialog to variables on pages? 55 56Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 57 58Use a custom callback so that when the confirm button in the custom dialog box is clicked, the value of **data** is transferred from the dialog box to the current page. 59 60Example: 61 62 63``` 64// Dialog box component 65@CustomDialog 66struct MyDialog { 67 controller: CustomDialogController 68 title: string 69 confirm: (data: string) => void 70 data: string = '' 71 72 build() { 73 Row() { 74 Column({ space: 10 }) { 75 Text(this.title) 76 .fontSize(30) 77 .fontColor(Color.Blue) 78 TextInput({ placeholder: "Enter content", text: this.data }) 79 .onChange((data) => { 80 this.data = data // Obtain the data in the text box. 81 }) 82 Button('confirm') 83 .onClick(() => { 84 this.confirm(this.data) // Transfer the data in the text box to the main page through the callback. 85 this.controller.close() 86 }).backgroundColor(0xffffff).fontColor(Color.Red) 87 }.width("50%") 88 }.height("50%") 89 } 90} 91 92// Main page 93@Entry 94@Component 95struct DialogTest { 96 @State dialogTitle: string = '' 97 @State dialogData: string = '' 98 dialogController: CustomDialogController = new CustomDialogController({ 99 builder: MyDialog({ 100 title: this.dialogTitle, // Bind data. 101 data: this.dialogData, 102 confirm: this.confirm.bind(this) // Bind the custom callback. Change the direction of this here. 103 }) 104 }) 105 106 confirm(data: string) { 107 this.dialogData = data 108 console.info(`recv dialog data: ${data}`) // Obtain the information entered in the dialog box. 109 } 110 111 build() { 112 Row() { 113 Column({ space: 10 }) { 114 Button ('Open Dialog Box') 115 .onClick(() => { 116 this.dialogTitle ='Dialog Box' 117 this.dialogController.open() 118 }) 119 Text(`Accept pop-up window data:`) 120 .fontSize(20) 121 TextInput ({ placeholder: "Input", text: this.dialogData }) 122 .width("50%") 123 .onChange((data) => { 124 this.dialogData = data //Obtain the data in the text box. 125 }) 126 }.width("100%") 127 }.height("100%") 128 } 129} 130``` 131 132## What should I do if the \<List> component cannot be dragged to the bottom after it has a \<Text> component added? 133 134Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 135 136The **\<List>** component is a scrollable container. By default, it takes up the entire screen height. When any component with a fixed height takes up part of the screen height, you need to explicitly specify **layoutWeight(1)** for the parent container of the **\<List>** component to take up the remaining height instead of the entire screen height. 137 138## How do I center child components in a grid container? 139 140Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 141 142By default, child components in a **\<GridContainer>** are horizontally aligned to the left. To center them, perform the following steps: 143 144Nest a **\<Row>** component and set it to **justifyContent(FlexAlign.Center)**. For details, see [Grid Layout](../reference/arkui-ts/ts-container-gridcontainer.md). 145 146Example: 147 148``` 149GridContainer({ sizeType: SizeType.SM, columns: 12 }) { 150 Row() { 151 Text('1') 152 .useSizeType({ 153 sm: { span: 4, offset: 0 }, 154 }) 155 .backgroundColor(0x46F2B4) 156 }.justifyContent(FlexAlign.Center) // Center child components. 157} 158``` 159 160## How do I obtain the height of the status bar and navigation bar? 161 162Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 163 164Before the window content is loaded, enable listening for the **systemAvoidAreaChange** event. 165 166Example: 167 168```ts 169import Window from '@ohos.window'; 170import UIAbility from '@ohos.app.ability.UIAbility'; 171 172/** 173 * Set the immersive window and obtain the height of the status bar and navigation bar. 174 * @param mainWindow Indicates the main window. 175 */ 176async function enterImmersion(mainWindow: window.Window) { 177 mainWindow.on("systemAvoidAreaChange", (area: window.AvoidArea) => { 178 AppStorage.SetOrCreate<number>("topHeight", area.topRect.height); 179 AppStorage.SetOrCreate<number>("bottomHeight", area.bottomRect.height); 180 }) 181 await mainWindow.setFullScreen(true) 182 await mainWindow.setSystemBarEnable(["status", "navigation"]) 183 await mainWindow.sArkTSystemBarProperties({ 184 navigationBarColor: "#00000000", 185 statusBarColor: "#00000000", 186 navigationBarContentColor: "#FF0000", 187 statusBarContentColor: "#FF0000" 188 }) 189} 190export default class EntryAbility extends UIAbility { 191 // do something 192 async onWindowStageCreate(windowStage: window.WindowStage) { 193 let mainWindow = await windowStage.getMainWindow() 194 await enterImmersion(mainWindow) 195 windowStage.loadContent('pages/index') 196 } 197 // do something 198} 199``` 200 201## How do I fix misidentification of the pan gesture where container nesting is involved? 202 203Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 204 205Set the **distance** attribute to **1** for the gesture. By default, this attribute is set to **5**. 206 207## How do I obtain the height of a component? 208 209Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 210 211You can obtain the changes in the width and height of a component through **onAreaChange**. 212 213Example: 214 215 216```ts 217Column() { 218 Text(this.value) 219 .backgroundColor(Color.Green).margin(30).fontSize(20) 220 .onClick(() => { 221 this.value = this.value + 'Text' 222 }) 223 .onAreaChange((oldValue: Area, newValue: Area) => { 224 console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} value is ${JSON.stringify(newValue)}`) 225 this.size = JSON.stringify(newValue) 226 }) 227``` 228 229## How do I obtain the offset of the \<List> component? 230 231Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 232 233Bind the **\<List>** component to a **Scoller** object and obtain the offset through **currentOffset**. 234 235Example: 236 237 238```ts 239Column() { 240 List({ space: 20, initialIndex: 0,scroller: this.scroller}) { 241 ForEach(this.arr, (item) => { 242 ListItem() { 243 Text('' + item) 244 .width('100%').height(100).fontSize(16) 245 .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) 246 }.editable(true) 247 }, item => item) 248 } 249 .listDirection(Axis.Vertical) // Arrangement direction 250 .editMode(this.editFlag) 251 .onScroll((xOffset: number, yOffset: number) => { 252 console.info("yOffset======="+this.scroller.currentOffset().yOffset) 253 }) 254}.width('100%') 255``` 256 257## How do I obtain the value of param for the target page of redirection implemented using router? 258 259Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 260 261 262```ts 263// In versions earlier than 3.1.5.5, obtain the value through router.getParams().key. 264private value: string = router.getParams().value; 265// In 3.1.6.5 and later versions, obtain the value through router.getParams()['key']. 266private value: string = router.getParams()['value']; 267``` 268 269## Does the \<RichText> component support redirection to a local page? 270 271Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 272 273No. This feature is not supported. 274 275## How do I disable the transition effect for pages switched using router or navigator? 276 277Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 278 2791. Define the **pageTransition** method for the current and target pages, by following instructions in [Example](../reference/arkui-ts/ts-page-transition-animation.md#example). 280 2812. Set the **duration** parameter of both **PageTransitionEnter** and **PageTransitionExit** to **0**. 282 283## How do I select the pixel unit during UI development? 284 285Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 286 287It depends. 288 289The vp unit ensures consistency of visual effects across resolutions. For example, it ensures that an icon is displayed consistently under different resolutions. 290 291The lpx unit produces a visual effect where items are zoomed in or out proportionally. 292 293If you are concerned about visual effect consistency of items, for example, buttons, texts, and lists, use the vp unit. If your focus is on the layout, for example, 1/2 grid, the lpx is a better choice. 294 295## What color formats are used in ArkTS? 296 297Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 298 299The color can be represented in two formats, for example, 0x7F000000 or '\#7F000000'. The first two digits indicate opacity, and the last six digits indicate RGB. 300 301 302```ts 303fontColor(0x7F000000) 304fontColor( '#7F000000' ) 305``` 306 307## How do I listen for the return operation on a page? 308 309Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 310 311When a return operation is performed on a page, the system calls the **onBackPress()** callback of the **@Entry** decorated custom component. You can implement related service logic in the callback. 312 313Reference: [Custom Component Lifecycle Callbacks](../ui/ui-ts-custom-component-lifecycle-callbacks.md) 314 315## Can I customize the eye icon for the \<TextInput> component in password mode? 316 317Applicable to: OpenHarmony SDK 3.0, stage model of API version 9 318 319No. The eye icon can be shown or hidden through **showPasswordIcon** when **type** of the **\<TextInput>** component is set to **InputType.Password**. It cannot be customized. 320 321Reference: [TextInput](../reference/arkui-ts/ts-basic-components-textinput.md) 322 323## Why can't images be loaded over HTTP? 324 325Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 326 327HTTP is insecure and HTTP sources will be filtered out by the trustlist. For security purposes, use HTTPS. 328 329## What should I do if the spacing set for the TextView layout does not fit the UI? 330 331Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 332 333By default, the **align** attribute of **TextView** is set to **Center**. To display the text from left to right, set the **align** attribute to **Start**. 334 335## Why do the constraintSize settings fail to take effect? 336 337Applicable to: OpenHarmony SDK 3.0, stage model of API version 9 338 339If **constraintSize** is set for a component and the width of its child component is set to a percentage, for example, **width('100%')**, **constraintSize** takes effect by multiplying the maximum width by the percentage. As a result, the child component may overflow, in which case it looks like the **constraintSize** settings fail to take effect. 340 341## How do I set the background color to transparent? 342 343Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 344 345Set **backgroundColor** to **'\#00000000'**. 346 347## What should I do if the \<Scroll> component cannot scroll to the bottom? 348 349Applicable to: OpenHarmony SDK 3.0, stage model of API version 9 350 351Unless otherwise specified, the height of the **\<Scroll>** component is equal to the window height. In this case, the component's bottom area will be blocked by components (if any) outside of it. To fix this issue, set the height of the **\<Scroll>** component or use the flex layout to limit this height. 352 353## How do I use the onSubmit event of the \<TextInput> component? 354 355Applicable to: OpenHarmony SDK 3.0, stage model of API version 9 356 357The **onSubmit** event is triggered when the Enter key is pressed and accepts the current Enter key type as its input parameter. You can set the Enter key type for the **\<TextInput>** component through the **enterKeyType** attribute. The Enter key style of the soft keyboard requires the support of the input method. 358 359Reference: [TextInput](../reference/arkui-ts/ts-basic-components-textinput.md) 360 361## What is the maximum number of pages allowed during page routing? 362 363Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 364 365The maximum number of pages supported by the page stack is 32. When this limit is reached, the **router.push** API cannot be used for page redirection. 366 367## Does ArkUI allow components to be dynamically created in code? 368 369Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 370 371Yes. You can dynamically creaete components using [conditional rendering](../quick-start/arkts-rendering-control.md#conditional-rendering) and [loop rendering](../quick-start/arkts-rendering-control.md#loop-rendering). 372 373## What should I do if the PixelMap object carried in page routing cannot be obtained from the target page? 374 375Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 376 377Page routing supports only the common object type and common JSON data structure. To pass a **PixelMap** object to the target page, store it in the **localStorage**. 378 379## How do I use .caretPosition(0) to move the caret to the start of the text area when onEditChange is triggered for the \<TextInput> component? 380 381Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 382 383The **onEditChange** event is triggered when the input box gains focus. Under this scenario, the caret position is related to the position where the gesture is when the event is triggered, and **caretPosition** cannot be used to change the caret position. Call **setTimeout** for asynchronous processing first. 384 385## Is there any method for selecting all items in the \<TextInput> component? 386 387Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 388 389No. This feature is not supported yet. 390 391## Why can't I select a date when the type attribute of the input text box is set to date? 392 393Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 394 395Setting the **type** attribute of the input component to **date** means that the component accepts dates as input and the user will be notified of the valid input format. It does not display a date picker. To display a date picker, use the **\<DatePicker>** component. 396 397## What should I do if the displayed input keyboard gets squeezed when using the **\<TextInput>** component? 398 399Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 400 401This issue may occur when the flex layout is used. To fix it, switch to the column layout. 402 403## How does the parent component pass values to a @Link decorated member variable in its child component? 404 405Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 406 407To pass a value from the parent component to the **@Link** decorated member variable in a child component, add **"$"** in front of the value. 408 409Example: 410 411 412``` 413@Component 414struct FoodImageDisplay { 415 @Link imageSrc: Resource 416 417 build() { 418 Stack({ alignContent: Alignment.BottomStart }) { 419 Image(this.imageSrc) 420 .objectFit(ImageFit.Contain) 421 Text('Tomato') 422 .fontSize(26) 423 .fontWeight(500) 424 .margin({ left: 26, bottom: 17.4 }) 425 } 426 .backgroundColor('#FFedf2f5') 427 .height(357) 428 } 429} 430 431@Entry 432@Component 433struct FoodDetail { 434 435 @State imageSrc: Resource = $r('app.media.Tomato') 436 437 build() { 438 Column() { 439 FoodImageDisplay({imageSrc:$imageSrc}) 440 } 441 .alignItems(HorizontalAlign.Center) 442 } 443} 444``` 445 446## How do I share variables between Page abilities? 447 448Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 449 4501. Use a lightweight database. 451 4522. Use persistent data management. 453 4543. Use the emitter event communication mechanism. 455 456 457## How do I customize the control bar style of the \<Video> component? 458 459Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 460 4611. Set **controls** to **false** to disable the default control bar. 462 4632. Set **controller** for the **\<Video>** component. 464 4653. Implement a custom control bar in ArkTS and use **VideoController** to control video playback. 466 467## How do I optimize the performance when an ArkTS component is to be updated for multiple times? 468 469Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 470 471Extract the ArkTS component to be updated into a custom component and update the **@State** decorated variables in the custom component to implement partial refresh. 472 473## How do I optimize the \<Tab> component performance? 474 475Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 476 477When the **\<Tab>** component is on a tab page, other tab pages are not unloaded by the system and still occupy some memory. To improve performance, you can use **if** to check whether the current tab page is being displayed and unload it if it is not. In this way, the tab pages not being displayed can be unloaded and the memory occupied by them can be released. 478 479## How do I set state-specific styles for a component? 480 481Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 482 483You can use the polymorphic style attribute to set styles of the component for different states (being stateless, in pressed state, in disabled state, in focused state, or in clicked state). 484 485Reference: [Polymorphic Style](../reference/arkui-ts/ts-universal-attributes-polymorphic-style.md) 486 487## Why can't the onBlur or onFocus callback be triggered? 488 489Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 490 491Only the Tab button and arrow buttons on the connected keyboard can be used to trigger the focus event. In addition, to trigger a focus event by a touch, the **focusOnTouch** attribute must be added for the component. 492 493Reference: [Focus Control](../reference/arkui-ts/ts-universal-attributes-focus.md) 494 495## What should I do if the flex width and height in the \<Scroll> component conflicts with the scrolling? 496 497Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 498 499The **\<Scroll>** component supports a single child component, whose height is subject to the content height. If the scrolling layout is abnormal due to asynchronous loading of an image within the content, you can set the minimum height for the child component through **constraintSize({ minHeight: '100%' })**. 500 501## How do I block the page router from returning to the previous page? 502 503Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 504 505Call **router.clear()** to remove all historical pages in the page stack and retain the current page at the top of the stack. 506 507Reference: [Page Routing](../reference/apis/js-apis-router.md) 508 509## How do I clear the content of the \<TextInput> component at once? 510 511Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 512 513Refer to the following: 514 515 516``` 517struct Index { 518@State text: string = 'Hello World' 519controller: TextInputController = new TextInputController() 520 build() { 521 Row() { 522 Column() { 523 TextInput({ placeholder: 'Please input your words.', text: this.text, 524 controller:this.controller}).onChange((value) => { 525 this.text = value 526 }) 527 Button("Clear TextInput").onClick(() => { 528 this.text = ""; 529 }) 530 } 531 .width('100%') 532 } 533 .height('100%') 534 } 535} 536``` 537 538## Can tab switching be disabled for the \<Tabs> component? 539 540Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 541 542No. This feature is not supported. 543 544## An error is reported when @state is used to decorate the id member variable: "TypeError: cannot read property 'get' of undefined." Why? 545 546Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 547 548The ID has been added as a unique value and becomes a keyword. 549 550## Can I use the fontFamily attribute to set different fonts for OpenHarmony applications? 551 552Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 553 554No. For applications developed based on OpenHarmony, the default font and also the only supported font is HarmonyOS Sans. 555 556## What is the recommended data interaction mode between an ability and UI page? 557 558Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 559 560[LocalStorage](../quick-start/arkts-state-mgmt-application-level.md#localstorage) is recommended. 561 562## How does a parent component synchronize status with its grandchild components? 563 564Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 565 566- Method 1 (recommended): Use the **@Provide** and **@Consume** decorators. Specifically, use **@Provide** in the parent component and **@Consume** in the grandchild component to implement two-way data binding between the components. 567 568- Method 2: Use the **@State** and **@Link** decorators. Specifically, use **@State** in the parent component, and **@Link** in all involved child and grandchild components. 569 570## How do I display an ellipsis in cases when the string is too long to display in full? 571 572Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 573 574Example: 575 576 577``` 578beautySub(str,len) { 579 var reg = /[\u4e00-\u9fa5]/g; 580 // Reduce characters whenever possible. 581 var slice = str.substring(0,len) 582 var charNum = (~~(slice.match(reg) && slice.match(reg).length)) 583 // The purpose of charNum-1 is to process the string that exceeds the maximum value. If the string exceeds the maximum value, the character that is not in current language is not displayed. 584 var realen = slice.length*2 - charNum-1 585 return str.substr(0,realen) + (realen < str.length ? "..." : "") +str.substr(str.length-realen,str.length) 586} 587``` 588 589## How do I add a scrollbar to the \<richText> component? 590 591Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 592 593The **\<RichText>** component is underpinned by web. To add a scrollbar, you can refer to the HTML syntax and add the **overflow: auto** style to **div**. 594 595## How do I disable the scroll event of a grid in the \<Scroll> component? 596 597Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 598 599You can use the **onScrollBegin** event and the **scrollBy** method to implement nested scrolling of the containers. 600 601Reference: [Scroll](../reference/arkui-ts/ts-container-scroll.md#example-2) 602 603## Can the white background of the custom dialog box be removed? 604 605Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 606 607No. This feature is not supported. The UI style is hardcoded in the framework and cannot be changed. 608 609## Does the **backgroundImage** API support the SVG image format? 610 611Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 612 613No. This image format is not supported. 614 615## How do I set the position for a custom dialog box? 616 617Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 618 619You can set the position for a custom dialog box through the **alignment** parameter. For example, to set the custom dialog box to show at the bottom, set **alignment** to **DialogAlignment.Bottom**. 620 621Reference: [Custom Dialog Box](../reference/arkui-ts/ts-methods-custom-dialog-box.md) 622 623## How does the scroller determine the end error of the rebound animation? 624 625Applicable to: OpenHarmony SDK 3.2.5.3, FA model of API version 8 626 627After the touch ends, a change in the same direction may be calculated. If the change is in the opposite direction, it indicates that a rebound occurs, and no processing is performed. 628 629 630## How do I implement persistent storage of application data? 631 632Use the **PersistentStorage** class to manage persistent application data. Persistent data with specific tags can be linked to the **AppStorage** and accessed through the **AppStorage** APIs. 633 634Reference: [PersistentStorage](../quick-start/arkts-state-mgmt-application-level.md#persistentstorage) 635 636Example: 637 638 639``` 640AppStorage.Link('varA') 641PersistentStorage.PersistProp("varA", "111"); 642@Entry 643@Componentstruct Index { 644 @StorageLink('varA') varA: string = '' 645 build() { 646 Column() { 647 Text('varA: ' + this.varA).fontSize(20) 648 Button('Set').width(100).height(100).onClick(() => { 649 this.varA += '333' 650 }) 651 } 652 .width('100%') 653 .height('100%') 654 } 655} 656``` 657