Skip to content

Cell Component

The cell component is generally used for groups of lists, such as personal center pages, settings pages, etc.

📌Platform Difference Notes

APP(vue)H5WeChat Mini ProgramAlipay Mini Program

🏯Basic Usage Example

Tip

If you want to use click events on hy-cell, you must set a unique name value for each hy-cell-item to distinguish which child element was clicked

html
<template>
    <!-- Global usage -->
    <hy-cell @click="onClick">
        <hy-cell-item
            title="Toolbox"
            name="tools"
            :icon="{ name: IconConfig.SETTING, color: 'red' }"
        ></hy-cell-item>
        <hy-cell-item title="Mine" name="my" sub="I am a magical little box" value="Back"></hy-cell-item>
        <hy-cell-item title="Disabled" name="disabled" disabled></hy-cell-item>
    </hy-cell>
</template>

Setting the icon content

vue
<template>
    <hy-cell>
        <hy-cell-item
            title="Toolbox"
            :icon="{ name: IconConfig.SETTING, color: 'red' }"
        ></hy-cell-item>
    </hy-cell>

    <!-- Custom icon -->
    <hy-cell>
        <hy-cell-item title="Toolbox">
            <template #icon>
                <hy-icon name="tools" />
            </template>
        </hy-cell-item>
    </hy-cell>
</template>

Right-side content positioning

  • Change the position of the value by setting arrange
    • left: left
    • center: center
    • right: right
html
<template>
    <hy-cell arrange="left"></hy-cell>
    <hy-cell arrange="center"></hy-cell>
    <hy-cell arrange="right"></hy-cell>
</template>

Cell size

  • Set the cell size via size
    • small: small
    • medium: default
    • large: large
html
<template>
    <hy-cell size="small"></hy-cell>
    <hy-cell size="medium"></hy-cell>
    <hy-cell size="large"></hy-cell>
</template>

Rotating the right arrow up, down, or left

  • Set the arrow direction via arrow-direction
    • up: up
    • right: right
    • down: down
    • left: left
html
<template>
    <hy-cell arrow-direction="up"></hy-cell>
    <hy-cell arrow-direction="right"></hy-cell>
    <hy-cell arrow-direction="down"></hy-cell>
    <hy-cell arrow-direction="left"></hy-cell>
</template>
html
<template>
    <hy-cell>
        <hy-cell-item url="/page/index/tools"></hy-cell-item>
    </hy-cell>
</template>

API

Cell Props

ParameterDescriptionTypeDefault
borderWhether to show the cell's bottom borderbooleantrue
disabledWhether to disable the cellbooleanfalse
clickableWhether to enable click feedback (shown as a gray background on click)booleanfalse
sizeSize of the cell, default unit is pxstring|numbermedium
arrangeWhether the content is vertically centered (mainly for the value on the right side)stringright
isRightIconWhether to show the right iconbooleantrue
arrowDirectionDirection of the right arrowstringright
customStyleDefine external styles to be usedCSSProperties-
customClassCustom external class namestring-

CellItem Props

ParameterDescriptionTypeDefault
titleHeader titlestring-
subSmall hint below the titlestring-
disabledWhether to disable the cellbooleanfalse
valueRight-side contentstring|number-
iconLeft icon, Icon APIHyIconProps-
rightIconRight icon, Icon APIHyIconProps-
arrowDirectionDirection of the right arrowstringright
urlURL address to navigate to after clickingstring-
stopWhether to stop event propagation on cell clickbooleantrue
nameIdentifier, used for returning in the click eventstring|number-
customStyleDefine external styles to be usedCSSProperties-
customClassCustom external class namestring-

Events

Cell Emits

Event NameDescriptionCallback Parameter
clickTriggered when a cell in the list is clickedname: unique identifier

CellItem Emits

Event NameDescriptionCallback Parameter
clickTriggered when a cell in the list is clickedname: unique identifier

Cell Slots

Slot NameDescriptionReceived Value
defaultDefault insertion of CellItem componentstitle

CellItem Slots

Slot NameDescriptionReceived Value
titleCustom content for the cell titletitle
iconCustom left iconicon
subCustom subtitle contentsub
valueCustom right-side value contentrecord
right-iconCustom right-side icon contenticon
03:29