文档管理中心

您当前正在浏览HarmonyOS最新文档,覆盖已发布的所有API版本,可在API参考中筛选您使用的API版本。详细的版本配套关系请参考版本说明。

指南与API参考API参考应用框架ArkUI(方舟UI框架)ArkTS组件行列与堆叠Flex

Flex

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

Flex是以弹性方式布局子组件的容器组件,能够高效地排列、对齐子元素并分配剩余空间。

具体指南请参考弹性布局。

说明
  • 该组件从API version 7开始支持。后续版本如有新增内容将采用上角标单独标记该内容的起始版本。
  • Flex组件在渲染时存在二次布局过程,因此在对性能有严格要求的场景下建议使用Column、Row代替。最佳实践请参考布局优化指导-合理使用布局组件。
  • Flex组件主轴不设置长度时默认撑满父容器,如果包含设置position的子组件,此时Flex组件不会撑满父容器。Column、Row组件主轴不设置长度时默认跟随子节点大小。
  • Flex、Column、Row组件在没有子节点且不设置宽高时,默认宽高为-1。
  • 主轴长度可设置为auto使Flex自适应子组件布局,自适应时,Flex长度受constraintSize属性以及父容器传递的最大最小长度限制,且constraintSize属性优先级更高。

子组件

可以包含子组件。

接口

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

Flex(value?: FlexOptions)

创建Flex布局容器,用于以弹性方式排列、对齐子组件并分配剩余空间。

卡片能力: 从API version 9开始,该接口支持在ArkTS卡片中使用。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

系统能力: SystemCapability.ArkUI.ArkUI.Full

参数:

展开
参数名 类型 必填 说明
value FlexOptions 否 Flex容器的配置选项,用于设置子组件的排列方向、换行方式、对齐方式和间距。不传入时使用默认配置,各属性默认值详见FlexOptions对象说明。

FlexOptions对象说明

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

设置Flex子组件的排列对齐方式。

系统能力: SystemCapability.ArkUI.ArkUI.Full

展开
名称 类型 只读 可选 说明
direction FlexDirection 否 是

子组件在Flex容器上排列的方向,即主轴的方向。设置后,子组件将按照指定的方向在主轴上依次排列。

默认值:FlexDirection.Row

异常值按默认值处理。

取值包括:

- Row:主轴为水平方向,起点在左端。

- RowReverse:主轴为水平方向,起点在右端。

- Column:主轴为垂直方向,起点在上端。

- ColumnReverse:主轴为垂直方向,起点在下端。

Row和RowReverse的起点位置受容器的direction属性影响。

卡片能力: 从API version 9开始,该接口支持在ArkTS卡片中使用。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

wrap FlexWrap 否 是

Flex容器是单行/列还是多行/列排列。设置后,子组件将在容器中按指定的换行方式进行布局。

默认值:FlexWrap.NoWrap

异常值按默认值处理。

取值包括:

- NoWrap:不换行,子组件总宽度超过容器宽度时被截断。

- Wrap:换行,第一行在上方。

- WrapReverse:换行,第一行在下方。

说明:

在多行布局时,通过交叉轴方向,确认新行堆叠方向。

卡片能力: 从API version 9开始,该接口支持在ArkTS卡片中使用。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

justifyContent FlexAlign 否 是

所有子组件在Flex容器主轴上的对齐格式。设置后,子组件将按照指定的对齐方式在主轴方向上分布和排列。

默认值:FlexAlign.Start

异常值按默认值处理。

取值包括:

- Start:首端对齐。

- Center:居中对齐。

- End:尾端对齐。

- SpaceBetween:两端对齐,子组件之间间距相等。

- SpaceAround:子组件两侧间距相等。

- SpaceEvenly:子组件之间及两端间距完全相等。

说明: 当justifyContent设置为SpaceBetween、SpaceAround、SpaceEvenly时,space参数不生效。

卡片能力: 从API version 9开始,该接口支持在ArkTS卡片中使用。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

alignItems ItemAlign 否 是

所有子组件在Flex容器交叉轴上的对齐格式。设置后,子组件将按照指定的对齐方式在交叉轴方向上定位。

默认值:ItemAlign.Start

异常值按默认值处理。

取值包括:

- Auto:使用父容器的对齐方式。

- Start:首部对齐。

- Center:居中对齐。

- End:尾部对齐。

- Stretch:拉伸填充。

- Baseline:基线对齐。

卡片能力: 从API version 9开始,该接口支持在ArkTS卡片中使用。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

alignContent FlexAlign 否 是

当交叉轴存在额外空间时,多行内容之间的对齐方式。仅在wrap为Wrap或WrapReverse下生效。

默认值:FlexAlign.Start

异常值按默认值处理。

取值包括:

- Start:首端对齐。

- Center:居中对齐。

- End:尾端对齐。

- SpaceBetween:两端对齐,行与行之间间距相等。

- SpaceAround:每行两侧间距相等。

- SpaceEvenly:行与行之间及两端间距完全相等。

卡片能力: 从API version 9开始,该接口支持在ArkTS卡片中使用。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

space12+ FlexSpaceOptions12+ 否 是

设置Flex容器子组件在主轴和交叉轴上的间距,包含main和cross两个属性。当需要调整子组件之间的间距时传入此参数,不传入时子组件之间无间距。

默认值:{main: LengthMetrics.px(0), cross: LengthMetrics.px(0)}

非法值:按默认值处理。

当space.main或space.cross的值为负数,或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时,space参数不生效。其中main属性在单行或多行布局时均生效,cross属性仅在wrap为Wrap或WrapReverse(多行布局)时生效。

space.main和space.cross均不支持设置百分比。

元服务API: 从API version 12开始,该接口支持在元服务中使用。

模型约束: 此接口仅可在Stage模型下使用。

FlexSpaceOptions12+

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

设置Flex容器的子组件在主轴或交叉轴的间距。

元服务API: 从API version 12开始,该接口支持在元服务中使用。

模型约束: 此接口仅可在Stage模型下使用。

系统能力: SystemCapability.ArkUI.ArkUI.Full

展开
名称 类型 只读 可选 说明
main LengthMetrics 否 是

Flex容器主轴上相邻子组件之间的间距。设置后,主轴方向相邻子组件之间将按指定间距进行分隔,在单行或多行布局时均生效。当space.main为负数或设置百分比,或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时,该参数不生效。

默认值:LengthMetrics.px(0)

cross LengthMetrics 否 是

Flex容器交叉轴上相邻行之间的间距。设置后,交叉轴方向相邻行之间将按指定间距进行分隔,仅在多行布局(wrap为Wrap或WrapReverse)时生效。当space.cross为负数或设置百分比,或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时,该参数不生效。

默认值:LengthMetrics.px(0)

属性

支持通用属性。

事件

支持通用事件。

示例

示例1(子组件排列方向)

该示例通过设置direction实现不同的子组件排列方向效果。

收起
自动换行
深色代码主题
复制
  1. // xxx.ets
  2. @Entry
  3. @Component
  4. struct FlexExample1 {
  5. build() {
  6. Column() {
  7. Column({ space: 5 }) {
  8. Text('direction:Row').fontSize(9).fontColor(0xCCCCCC).width('90%')
  9. Flex({ direction: FlexDirection.Row }) { // 子组件在容器主轴上行布局
  10. Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
  11. Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
  12. Text('3').width('20%').height(50).backgroundColor(0xF5DEB3)
  13. Text('4').width('20%').height(50).backgroundColor(0xD2B48C)
  14. }
  15. .height(70)
  16. .width('90%')
  17. .padding(10)
  18. .backgroundColor(0xAFEEEE)
  19. Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
  20. Flex({ direction: FlexDirection.RowReverse }) { // 子组件在容器主轴上反向行布局
  21. Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
  22. Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
  23. Text('3').width('20%').height(50).backgroundColor(0xF5DEB3)
  24. Text('4').width('20%').height(50).backgroundColor(0xD2B48C)
  25. }
  26. .height(70)
  27. .width('90%')
  28. .padding(10)
  29. .backgroundColor(0xAFEEEE)
  30. Text('direction:Column').fontSize(9).fontColor(0xCCCCCC).width('90%')
  31. Flex({ direction: FlexDirection.Column }) { // 子组件在容器主轴上列布局
  32. Text('1').width('100%').height(40).backgroundColor(0xF5DEB3)
  33. Text('2').width('100%').height(40).backgroundColor(0xD2B48C)
  34. Text('3').width('100%').height(40).backgroundColor(0xF5DEB3)
  35. Text('4').width('100%').height(40).backgroundColor(0xD2B48C)
  36. }
  37. .height(160)
  38. .width('90%')
  39. .padding(10)
  40. .backgroundColor(0xAFEEEE)
  41. Text('direction:ColumnReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
  42. Flex({ direction: FlexDirection.ColumnReverse }) { // 子组件在容器主轴上反向列布局
  43. Text('1').width('100%').height(40).backgroundColor(0xF5DEB3)
  44. Text('2').width('100%').height(40).backgroundColor(0xD2B48C)
  45. Text('3').width('100%').height(40).backgroundColor(0xF5DEB3)
  46. Text('4').width('100%').height(40).backgroundColor(0xD2B48C)
  47. }
  48. .height(160)
  49. .width('90%')
  50. .padding(10)
  51. .backgroundColor(0xAFEEEE)
  52. }.width('100%').margin({ top: 5 })
  53. }.width('100%')
  54. }
  55. }

示例2(子组件单/多行排列)

该示例通过设置wrap实现子组件单行或多行的排列效果。

收起
自动换行
深色代码主题
复制
  1. // xxx.ets
  2. @Entry
  3. @Component
  4. struct FlexExample2 {
  5. build() {
  6. Column() {
  7. Column({ space: 5 }) {
  8. Text('Wrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
  9. Flex({ wrap: FlexWrap.Wrap }) { // 子组件多行布局
  10. Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
  11. Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
  12. Text('3').width('50%').height(50).backgroundColor(0xD2B48C)
  13. }
  14. .width('90%')
  15. .padding(10)
  16. .backgroundColor(0xAFEEEE)
  17. Text('NoWrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
  18. Flex({ wrap: FlexWrap.NoWrap }) { // 子组件单行布局
  19. Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
  20. Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
  21. Text('3').width('50%').height(50).backgroundColor(0xF5DEB3)
  22. }
  23. .width('90%')
  24. .padding(10)
  25. .backgroundColor(0xAFEEEE)
  26. Text('WrapReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
  27. Flex({ wrap: FlexWrap.WrapReverse , direction:FlexDirection.Row }) { // 子组件反向多行布局
  28. Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
  29. Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
  30. Text('3').width('50%').height(50).backgroundColor(0xD2B48C)
  31. }
  32. .width('90%')
  33. .height(120)
  34. .padding(10)
  35. .backgroundColor(0xAFEEEE)
  36. }.width('100%').margin({ top: 5 })
  37. }.width('100%')
  38. }
  39. }

示例3(子组件在主轴上的对齐格式)

该示例通过设置justifyContent实现子组件在主轴上不同的对齐效果。

收起
自动换行
深色代码主题
复制
  1. // xxx.ets
  2. @Component
  3. struct JustifyContentFlex {
  4. justifyContent: number = 0;
  5. build() {
  6. Flex({ justifyContent: this.justifyContent }) {
  7. Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
  8. Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
  9. Text('3').width('20%').height(50).backgroundColor(0xF5DEB3)
  10. }
  11. .width('90%')
  12. .padding(10)
  13. .backgroundColor(0xAFEEEE)
  14. }
  15. }
  16. @Entry
  17. @Component
  18. struct FlexExample3 {
  19. build() {
  20. Column() {
  21. Column({ space: 5 }) {
  22. Text('justifyContent:Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
  23. JustifyContentFlex({ justifyContent: FlexAlign.Start }) // 子组件在容器主轴上首端对齐
  24. Text('justifyContent:Center').fontSize(9).fontColor(0xCCCCCC).width('90%')
  25. JustifyContentFlex({ justifyContent: FlexAlign.Center }) // 子组件在容器主轴上居中对齐
  26. Text('justifyContent:End').fontSize(9).fontColor(0xCCCCCC).width('90%')
  27. JustifyContentFlex({ justifyContent: FlexAlign.End }) // 子组件在容器主轴上尾端对齐
  28. Text('justifyContent:SpaceBetween').fontSize(9).fontColor(0xCCCCCC).width('90%')
  29. JustifyContentFlex({ justifyContent: FlexAlign.SpaceBetween }) // 子组件在容器主轴上均分容器布局,第一个子组件与行首对齐,最后一个子组件与行尾对齐。
  30. Text('justifyContent:SpaceAround').fontSize(9).fontColor(0xCCCCCC).width('90%')
  31. JustifyContentFlex({ justifyContent: FlexAlign.SpaceAround }) // 子组件在容器主轴上均分容器布局,每个子组件两侧都有相等的空间,因此第一个子组件到行首的距离和最后一个子组件到行尾的距离是相邻子组件之间距离的一半。
  32. Text('justifyContent:SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%')
  33. JustifyContentFlex({ justifyContent: FlexAlign.SpaceEvenly }) // 子组件在容器主轴上均分容器布局,子组件之间的距离与第一子组件到行首、最后一个子组件到行尾的距离相等
  34. }.width('100%').margin({ top: 5 })
  35. }.width('100%')
  36. }
  37. }

示例4(子组件在交叉轴上的对齐方式)

该示例通过设置alignItems实现子组件在交叉轴上的不同的对齐效果。

收起
自动换行
深色代码主题
复制
  1. // xxx.ets
  2. @Component
  3. struct AlignItemsFlex {
  4. alignItems: number = 0;
  5. build() {
  6. Flex({ alignItems: this.alignItems }) {
  7. Text('1').width('33%').height(30).backgroundColor(0xF5DEB3)
  8. Text('2').width('33%').height(40).backgroundColor(0xD2B48C)
  9. Text('3').width('33%').height(50).backgroundColor(0xF5DEB3)
  10. }
  11. .size({width: '90%', height: 80})
  12. .padding(10)
  13. .backgroundColor(0xAFEEEE)
  14. }
  15. }
  16. @Entry
  17. @Component
  18. struct FlexExample4 {
  19. build() {
  20. Column() {
  21. Column({ space: 5 }) {
  22. Text('alignItems:Auto').fontSize(9).fontColor(0xCCCCCC).width('90%')
  23. AlignItemsFlex({ alignItems: ItemAlign.Auto }) // 子组件在容器交叉轴上自动对齐
  24. Text('alignItems:Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
  25. AlignItemsFlex({ alignItems: ItemAlign.Start }) // 子组件在容器交叉轴上首部对齐
  26. Text('alignItems:Center').fontSize(9).fontColor(0xCCCCCC).width('90%')
  27. AlignItemsFlex({ alignItems: ItemAlign.Center }) // 子组件在容器交叉轴上居中对齐
  28. Text('alignItems:End').fontSize(9).fontColor(0xCCCCCC).width('90%')
  29. AlignItemsFlex({ alignItems: ItemAlign.End }) // 子组件在容器交叉轴上尾部对齐
  30. Text('alignItems:Stretch').fontSize(9).fontColor(0xCCCCCC).width('90%')
  31. AlignItemsFlex({ alignItems: ItemAlign.Stretch }) // 子组件在容器交叉轴上拉伸填充
  32. Text('alignItems:Baseline').fontSize(9).fontColor(0xCCCCCC).width('90%')
  33. AlignItemsFlex({ alignItems: ItemAlign.Baseline }) // 子组件在容器交叉轴上与文本基线对齐
  34. }.width('100%').margin({ top: 5 })
  35. }.width('100%')
  36. }
  37. }

示例5(多行内容的对齐方式)

该示例通过设置alignContent实现多行内容的不同对齐效果。

收起
自动换行
深色代码主题
复制
  1. // xxx.ets
  2. @Component
  3. struct AlignContentFlex {
  4. alignContent: number = 0;
  5. build() {
  6. Flex({ wrap: FlexWrap.Wrap, alignContent: this.alignContent }) {
  7. Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
  8. Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
  9. Text('3').width('50%').height(20).backgroundColor(0xD2B48C)
  10. }
  11. .size({ width: '90%', height: 90 })
  12. .padding(10)
  13. .backgroundColor(0xAFEEEE)
  14. }
  15. }
  16. @Entry
  17. @Component
  18. struct FlexExample5 {
  19. build() {
  20. Column() {
  21. Column({ space: 5 }) {
  22. Text('alignContent:Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
  23. AlignContentFlex({ alignContent: FlexAlign.Start }) // 多行布局下子组件首部对齐
  24. Text('alignContent:Center').fontSize(9).fontColor(0xCCCCCC).width('90%')
  25. AlignContentFlex({ alignContent: FlexAlign.Center }) // 多行布局下子组件居中对齐
  26. Text('alignContent:End').fontSize(9).fontColor(0xCCCCCC).width('90%')
  27. AlignContentFlex({ alignContent: FlexAlign.End }) // 多行布局下子组件尾部对齐
  28. Text('alignContent:SpaceBetween').fontSize(9).fontColor(0xCCCCCC).width('90%')
  29. AlignContentFlex({ alignContent: FlexAlign.SpaceBetween }) // 多行布局下第一行子组件与列首对齐,最后一行子组件与列尾对齐
  30. Text('alignContent:SpaceAround').fontSize(9).fontColor(0xCCCCCC).width('90%')
  31. AlignContentFlex({ alignContent: FlexAlign.SpaceAround }) // 多行布局下第一行子组件到列首的距离和最后一行子组件到列尾的距离是相邻行之间距离的一半
  32. Text('alignContent:SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%')
  33. Flex({
  34. wrap: FlexWrap.Wrap,
  35. alignContent: FlexAlign.SpaceEvenly
  36. }) { // 多行布局下相邻行之间的距离与第一行子组件到列首的距离、最后一行子组件到列尾的距离完全一样
  37. Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
  38. Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
  39. Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
  40. Text('4').width('50%').height(20).backgroundColor(0xD2B48C)
  41. Text('5').width('50%').height(20).backgroundColor(0xF5DEB3)
  42. }
  43. .size({ width: '90%', height: 100 })
  44. .padding({ left: 10, right: 10 })
  45. .backgroundColor(0xAFEEEE)
  46. }.width('100%').margin({ top: 5 })
  47. }.width('100%')
  48. }
  49. }

示例6(子组件单/多行排列时的主/交叉轴间距)

该示例通过设置space属性,为单/多行排列的子组件设置主轴和交叉轴上的间距。

收起
自动换行
深色代码主题
复制
  1. import {LengthMetrics} from '@kit.ArkUI';
  2. @Entry
  3. @Component
  4. struct FlexExample6 {
  5. build() {
  6. Column() {
  7. Column({ space: 5 }) {
  8. Text('Wrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
  9. Flex({ wrap: FlexWrap.Wrap, space: {main: LengthMetrics.px(50), cross: LengthMetrics.px(50)} }) { // 子组件多行布局
  10. Text('1').width('40%').height(50).backgroundColor(0xF5DEB3)
  11. Text('2').width('40%').height(50).backgroundColor(0xD2B48C)
  12. Text('3').width('40%').height(50).backgroundColor(0xD2B48C)
  13. }
  14. .width('90%')
  15. .padding(10)
  16. .backgroundColor(0xAFEEEE)
  17. Text('NoWrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
  18. Flex({ wrap: FlexWrap.NoWrap, space: {main: LengthMetrics.px(50), cross: LengthMetrics.px(50)} }) { // 子组件单行布局
  19. Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
  20. Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
  21. Text('3').width('50%').height(50).backgroundColor(0xF5DEB3)
  22. }
  23. .width('90%')
  24. .padding(10)
  25. .backgroundColor(0xAFEEEE)
  26. Text('WrapReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
  27. Flex({ wrap: FlexWrap.WrapReverse, direction:FlexDirection.Row, space: {main: LengthMetrics.px(50), cross: LengthMetrics.px(50)} }) { // 子组件反向多行布局
  28. Text('1').width('40%').height(50).backgroundColor(0xF5DEB3)
  29. Text('2').width('40%').height(50).backgroundColor(0xD2B48C)
  30. Text('3').width('40%').height(50).backgroundColor(0xD2B48C)
  31. }
  32. .width('90%')
  33. .height(120)
  34. .padding(10)
  35. .backgroundColor(0xAFEEEE)
  36. }.width('100%').margin({ top: 5 })
  37. }.width('100%')
  38. }
  39. }

示例7(宽度自适应的Flex容器)

该示例实现了Flex在宽度设置auto后可以自适应子组件布局的能力。

收起
自动换行
深色代码主题
复制
  1. @Component
  2. struct Demo {
  3. @Require @Prop text: string
  4. build() {
  5. Button() {
  6. Flex() {
  7. Image($r('sys.media.ohos_ic_public_voice'))
  8. .width(16)
  9. .height(16)
  10. Row() {
  11. Text(this.text)
  12. .margin({
  13. left: 6,
  14. right: 6
  15. })
  16. .fontSize(14)
  17. .maxLines(1)
  18. .textOverflow({ overflow: TextOverflow.Ellipsis })
  19. }
  20. Image($r('sys.media.ohos_ic_public_sound'))
  21. .width(16)
  22. .height(16)
  23. }.width('auto')
  24. }
  25. .backgroundColor(0xAFEEEE)
  26. .height(36)
  27. .padding({ left: 16, right: 16 })
  28. .constraintSize({ maxWidth: 156 })
  29. .width('auto')
  30. }
  31. }
  32. @Entry
  33. @Component
  34. struct FlexExample7 {
  35. build() {
  36. Column({ space: 12 }) {
  37. Text('Width does not reach max length').fontSize(11).fontColor(0XCCCCCC).width('50%')
  38. Demo({ text: '123' })
  39. Text('Width reaches max length').fontSize(11).fontColor(0XCCCCCC).width('50%')
  40. Demo({ text: '1234567890-1234567890-1234567890-1234567890' })
  41. }
  42. }
  43. }