• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import {
2  memo,
3  __memo_context_type,
4  __memo_id_type,
5  State,
6  StateDecoratedVariable,
7  MutableState,
8  stateOf,
9  observableProxy
10} from '@ohos.arkui.stateManagement'
11
12import {
13  Text,
14  TextAttribute,
15  Column,
16  Component,
17  Color,
18  ColumnOptions,
19  Stack,
20  Alignment,
21  Margin,
22  Entry,
23  NavDestination,
24  NavPathStack,
25  NavDestinationContext,
26  Callback
27} from '@ohos.arkui.component'
28
29import hilog from '@ohos.hilog'
30
31@Entry
32@Component
33export struct LayoutPropTest {
34
35  build() {
36    NavDestination() {
37      Column({ space: 5 } as ColumnOptions) {
38      // 设置子元素垂直方向间距为5
39      Text('space'). width('90%')
40      Column({ space: '15' } as ColumnOptions) {
41        Column().backgroundColor('#7b68ee').width('100%').height(30)
42        Column().backgroundColor('#ffc0cb').width('100%').height(30)
43      }.width('90%').height(100).border({ width: 1 })
44
45      Stack({ alignContent: Alignment.Bottom }) {
46        Text('First child').backgroundColor('#7b68ee').width('90%').height('100%')
47        Text('Second child').backgroundColor('#ffc0cb').width('70%').height('60%')
48      }.width('90%').height(150).margin({ top: 5 } as Margin).border({ width: 1 })
49
50    }. width('100%')
51    }
52    .title('布局属性组件功能')
53  }
54}
55
56