Skip to content

Cell

Cells are generally used in the case of a group of lists, such as personal center pages, settings pages, etc.

platform compatibility

App(vue)App(nvue)H5小程序VUE2VUE3

Basic usage

  • This component needs to be used with cell-group, and it realizes the upper and lower borders of the list group. If the upper and lower borders are not required, configure the border parameter of cellGroup to false.
  • Use title to set the title on the left, and value to set the content on the right.
  • Set the icon or image link through the icon field (absolute URL is recommended for local files).

Note: Since the cell component needs to be provided with parameter values ​​by the cellGroup component, these parent-child components inject dependencies through Vue's "provide/inject" feature, so you must wrap the cell component with cellGroup to Normal use.

vue
<template>
	<wu-cell-group>
		<wu-cell icon="setting-fill" title="Personal settings"></wu-cell>
		<wu-cell icon="integral-fill" title="membership level" value="new version"></wu-cell>
	</wu-cell-group>
</template>
<template>
	<wu-cell-group>
		<wu-cell icon="setting-fill" title="Personal settings"></wu-cell>
		<wu-cell icon="integral-fill" title="membership level" value="new version"></wu-cell>
	</wu-cell-group>
</template>

Custom content

  • The icon can be customized through the slot icon, and the content will replace the position of the icon on the left
  • Define the left title section via the slot title
  • Define the right content part through the slot right-icon
html
<wu-cell-group>
	<wu-cell  title="Magnificent sunset" arrow-direction="down">
		<wu-icon slot="icon" size="32" name="search"></wu-icon>
		<wu-switch slot="right-icon" v-model="checked"></wu-switch>
	</wu-cell>
	<wu-cell icon="setting-fill" title="just near dusk"></wu-cell>
</wu-cell-group>
<wu-cell-group>
	<wu-cell  title="Magnificent sunset" arrow-direction="down">
		<wu-icon slot="icon" size="32" name="search"></wu-icon>
		<wu-switch slot="right-icon" v-model="checked"></wu-switch>
	</wu-cell>
	<wu-cell icon="setting-fill" title="just near dusk"></wu-cell>
</wu-cell-group>

As shown above, you can use slot="right-icon" to set the badge or switch component that comes with the right wu-ui for the cell component:

  • If you are using the badge component, pay attention to set the absolute parameter to false to remove the absolute positioning, otherwise it will be in the right position on the right, see [Badge Logo Number](/en-US/components/badge. html).
  • If the switch component is used, be careful to bind a variable whose content is a Boolean value through v-model, otherwise the switch cannot be operated, see Switch switch selector for details.

Custom size

Set size to customize the size

html
<wu-cell-group>
	<wu-cell
	    size="large"
	    title="Cell"
	    value="Content"
	    isLink
	></wu-cell>
	<wu-cell
	    size="large"
	    title="Cell"
	    value="Content"
	    label="Description"
	></wu-cell>
</wu-cell-group>
<wu-cell-group>
	<wu-cell
	    size="large"
	    title="Cell"
	    value="Content"
	    isLink
	></wu-cell>
	<wu-cell
	    size="large"
	    title="Cell"
	    value="Content"
	    label="Description"
	></wu-cell>
</wu-cell-group>

Show right arrow

Set isLink to true, the arrow on the right will be displayed, and the direction of the arrow can be controlled by arrow-direction

html
<wu-cell-group>
	<wu-cell icon="share" title="停车坐爱枫林晚" :isLink="true" arrow-direction="down"></wu-cell>
	<wu-cell icon="map" title="霜叶红于二月花" :isLink="false"></wu-cell>
</wu-cell-group>
<wu-cell-group>
	<wu-cell icon="share" title="停车坐爱枫林晚" :isLink="true" arrow-direction="down"></wu-cell>
	<wu-cell icon="map" title="霜叶红于二月花" :isLink="false"></wu-cell>
</wu-cell-group>

Jump page

Set isLink to true, click on the cell to jump to the page, pass in url to set the jump address

html
<wu-cell-group>
	<wu-cell
	    title="open tab"
	    isLink
	    url="/pages/componentsB/tag/tag"
	></wu-cell>
	<wu-cell
	    title="open logo page"
	    isLink
	    url="/pages/componentsB/badge/badge"
	></wu-cell>
</wu-cell-group>
<wu-cell-group>
	<wu-cell
	    title="open tab"
	    isLink
	    url="/pages/componentsB/tag/tag"
	></wu-cell>
	<wu-cell
	    title="open logo page"
	    isLink
	    url="/pages/componentsB/badge/badge"
	></wu-cell>
</wu-cell-group>

Vertically center the content on the right

Set center to true to vertically center the content on the right

html
<wu-cell-group>
    <wu-cell
        title="Cell"
        value="Content"
        label="Description"
        center
    ></wu-cell>
</wu-cell-group>
<wu-cell-group>
    <wu-cell
        title="Cell"
        value="Content"
        label="Description"
        center
    ></wu-cell>
</wu-cell-group>

Custom slots

Set slot to title to customize the content of the left area. Set slot to value to customize the content of the right area

html
<wu-cell-group>
    <wu-cell value="内容">
        <template #title>
            <view class="wu-slot-title">
    		<text class="wu-cell-text">Cell</text>
    		<wu-tag
    		    text="Label"
    		    plain
    		    size="mini"
    		    type="warning"
    		>
    		</wu-tag>
    	</view>
        </template>
    </wu-cell>
    <wu-cell
        title="Cell"
    	isLink
    >
        <template #value>
            <text class="wu-slot-value">99</text>
        </template>
    </wu-cell>
</wu-cell-group>
<wu-cell-group>
    <wu-cell value="内容">
        <template #title>
            <view class="wu-slot-title">
    		<text class="wu-cell-text">Cell</text>
    		<wu-tag
    		    text="Label"
    		    plain
    		    size="mini"
    		    type="warning"
    		>
    		</wu-tag>
    	</view>
        </template>
    </wu-cell>
    <wu-cell
        title="Cell"
    	isLink
    >
        <template #value>
            <text class="wu-slot-value">99</text>
        </template>
    </wu-cell>
</wu-cell-group>

API

CellGroup Props

property namedescriptiontypedefault valueoptional values ​​
titlegroup titleString--
borderWhether to display the outer borderBooleantruetrue / false
customStyleuser-defined external style, object form, such as {'font-size': '12px'} or {'fontSize': '12px'}Object / String--

Cell Props

property namedescriptiontypedefault valueoptional values ​​
titleleft titleString / Number--
labeldescription information below the titleString / Number--
valuecontent on the right sideString / Number--
iconLeft icon name, or image link (absolute address is recommended for local files)String--
disabledWhether to disable the cellBooleanfalsetrue / false
borderWhether to display the bottom borderBooleantruetrue / false
centerWhether the content is vertically centered (mainly for the value part on the right)Booleanfalsetrue / false
urlURL address to jump after clickingString--
linkTypeThe way of link jumping, internally uses the route method encapsulated by wu-ui, which may be interceptedStringnavigateTo-
clickableWhether to enable click feedback (appears as a gray background when clicked)Booleanfalsetrue / false
isLinkWhether to show the right arrow and enable click feedbackBooleanfalsetrue / false
requiredWhether to display the required asterisk in the form state (this component may embed the input component)Booleanfalsetrue / false
rightIconright icon arrowStringarrow-right-
arrowDirectionThe direction of the right arrow, the optional values ​​are: left, up, downStringrightleft / right / up /down
iconStyleleft icon styleObject / String--
rightIconStylestyle of right arrow iconObject / String--
titleStylestyle of titleObject / String--
sizeThe size of the unit, the optional value is largeString--
stopWhether to stop event propagation when cell is clickedBooleantruetrue / false
nameIdentifier, used to return in click eventString / Number--

Cell Slot

Slot NameDescription
titleCustomize the content of the title part on the left. If you want to use it, please do not define the title parameter, or just assign null
valueCustomize the content of the title part on the right. If you want to use it, please do not define the value parameter, or just assign null
iconCustomize the left icon
right-iconCustomize the content of the right icon, you need to set arrow to false to work
labelCustomize label content

Cell Events

Event NameDescriptionCallback Parameters
clickTriggered when the cell list is clickedname: name parameter identifier of props