1e41f4b71Sopenharmony_ci# ColumnSplit 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci将子组件纵向布局,并在每个子组件之间插入一根横向的分割线。 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **说明:** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 8e41f4b71Sopenharmony_ci## 子组件 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci可以包含子组件。 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ciColumnSplit通过分割线限制子组件的高度。初始化时,分割线位置根据子组件的高度来计算。初始化后,后续动态修改子组件的高度则不生效,分割线位置保持不变,子组件高度可以通过拖动相邻分割线进行改变。 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci初始化后,动态修改[margin](ts-universal-attributes-size.md#margin)、[border](ts-universal-attributes-border.md#border)、[padding](ts-universal-attributes-size.md#padding)通用属性导致子组件尺寸大于相邻分割线间距的异常情况下,不支持拖动分割线改变子组件的高度。 15e41f4b71Sopenharmony_ci## 接口 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ciColumnSplit() 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci## 属性 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci### resizeable 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ciresizeable(value: boolean) 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci设置分割线是否可拖拽。 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci**参数:** 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 38e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------ | 39e41f4b71Sopenharmony_ci| value | boolean | 是 | 分割线是否可拖拽。<br/>默认值:false | 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci### divider<sup>10+</sup> 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_cidivider(value: ColumnSplitDividerStyle | null) 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci设置分割线的margin。 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci**参数:** 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 54e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 55e41f4b71Sopenharmony_ci| value | [ColumnSplitDividerStyle](#columnsplitdividerstyle10对象说明) \| null | 是 | 分割线的margin。<br/>默认值:null,分割线上下margin为0。ColumnSplitDividerStyle设置分割线与上下子节点的距离。 | 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci## ColumnSplitDividerStyle<sup>10+</sup>对象说明 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci| 名称 | 类型 | 必填 | 说明 | 64e41f4b71Sopenharmony_ci| ----------- | ------------- | ---- |--------------------------| 65e41f4b71Sopenharmony_ci| startMargin | [Dimension](ts-types.md#dimension10) | 否 | 分割线与其上方子组件的距离。<br/>默认值:0 | 66e41f4b71Sopenharmony_ci| endMargin | [Dimension](ts-types.md#dimension10) | 否 | 分割线与其下方子组件的距离。<br/>默认值:0 | 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci> **说明:** 69e41f4b71Sopenharmony_ci> 70e41f4b71Sopenharmony_ci> 与[RowSplit](ts-container-rowsplit.md#rowsplit)相同,ColumnSplit的分割线可以改变上下两边子组件的高度,子组件可改变高度的范围取决于子组件的最大最小高度。 71e41f4b71Sopenharmony_ci> 72e41f4b71Sopenharmony_ci> 支持[clip](ts-universal-attributes-sharp-clipping.md#clip)、[margin](ts-universal-attributes-size.md#margin)等通用属性,clip不设置的时候默认值为true。 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci## 示例 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci```ts 78e41f4b71Sopenharmony_ci// xxx.ets 79e41f4b71Sopenharmony_ci@Entry 80e41f4b71Sopenharmony_ci@Component 81e41f4b71Sopenharmony_cistruct ColumnSplitExample { 82e41f4b71Sopenharmony_ci build() { 83e41f4b71Sopenharmony_ci Column(){ 84e41f4b71Sopenharmony_ci Text('The secant line can be dragged').fontSize(9).fontColor(0xCCCCCC).width('90%') 85e41f4b71Sopenharmony_ci ColumnSplit() { 86e41f4b71Sopenharmony_ci Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) 87e41f4b71Sopenharmony_ci Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center) 88e41f4b71Sopenharmony_ci Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) 89e41f4b71Sopenharmony_ci Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center) 90e41f4b71Sopenharmony_ci Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) 91e41f4b71Sopenharmony_ci } 92e41f4b71Sopenharmony_ci .borderWidth(1) 93e41f4b71Sopenharmony_ci .resizeable(true) // 可拖动 94e41f4b71Sopenharmony_ci .width('90%').height('60%') 95e41f4b71Sopenharmony_ci }.width('100%') 96e41f4b71Sopenharmony_ci } 97e41f4b71Sopenharmony_ci} 98e41f4b71Sopenharmony_ci``` 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci 101