harmony 鸿蒙GridCol

2022-10-28 浏览 (783)

GridCol

The <GridCol> component must be used as a child component of the <GridRow> container.

NOTE

This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.

Child Components

This component can contain only one child component.

APIs

GridCol(option?:{span?: number|GridColColumnOption, offset?: number|GridColColumnOption, order?: number|GridColColumnOption})

Since API version 9, this API is supported in ArkTS widgets.

Parameters

NameTypeMandatoryDescription
spannumber |GridColColumnOptionNoNumber of columns occupied by the component. If it is set to 0, the component is not involved in layout calculation, that is, the component is not rendered.
Default value: 1
offsetnumber |GridColColumnOptionNoNumber of offset columns relative to the original position of the component.
Default value: 0
ordernumber |GridColColumnOptionNoSequence number of the element. Child components of the grid are sorted in ascending order based on their sequence numbers.
Default value: 0
NOTE
If a child component shares an order value with another child component or does not have order set, it is displayed based on its code sequence number.
If order is not set for all child components, those that have order set are displayed after those that do not and are sorted in ascending order based on the value.

NOTE

The values of span, offset, and order attributes are inherited in the sequence of xs, sm, md, lg, xl, and xxl. If no value is set for a breakpoint, the value is obtained from the previous breakpoint.

The default values vary by device width type.

Parameter\Breakpointxssmmdlgxlxxl
span223344
offset223555
order202020333

Attributes

NameTypeMandatoryDescription
spannumber |GridColColumnOptionNoNumber of occupied columns. If it is set to 0, the element is not involved in layout calculation, that is, the element is not rendered.
Default value: 1
Since API version 9, this API is supported in ArkTS widgets.
gridColOffsetnumber |GridColColumnOptionNoNumber of offset columns relative to the previous child component of the grid
Default value: 0
Since API version 9, this API is supported in ArkTS widgets.
ordernumber |GridColColumnOptionNoSequence number of the element. Child components of the grid are sorted in ascending order based on their sequence numbers.
Default value: 0
Since API version 9, this API is supported in ArkTS widgets.

GridColColumnOption

Describes the numbers of grid columns occupied by the <GridCol> component on devices with different width types.

Since API version 9, this API is supported in ArkTS widgets.

NameTypeMandatoryDescription
xsnumberNoNumber of grid columns occupied by the <GridCol> component on the minimum-width device.
smnumberNoNumber of grid columns occupied by the <GridCol> component on the small-width device.
mdnumberNoNumber of grid columns occupied by the <GridCol> component on the medium-width device.
lgnumberNoNumber of grid columns occupied by the <GridCol> component on the large-width device.
xlnumberNoNumber of grid columns occupied by the <GridCol> component on the extra-large-width device.
xxlnumberNoNumber of grid columns occupied by the <GridCol> component on the extra-extra-large-width device.

Example

See GridRow.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkTS-based Declarative Development Paradigm

harmony 鸿蒙@ohos.multimedia.avCastPicker (AVCastPicker)

harmony 鸿蒙Property Animation

harmony 鸿蒙Enums

harmony 鸿蒙Blank

harmony 鸿蒙Button

harmony 鸿蒙CalendarPicker

harmony 鸿蒙Checkbox

harmony 鸿蒙CheckboxGroup

harmony 鸿蒙DataPanel

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/261a6c4573374d10bcf79362e9c60164