
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@ophiuchus/cell
Advanced tools
单元格为列表中的单个展示项。
// 方式1(推荐)
import Vue from 'vue';
import Cell from '@ophiuchus/cell';
Vue.use(Cell);
// 方式2
import Vue from 'vue';
import { Cell, CellGroup } from '@ophiuchus/cell';
Vue.component(Cell.name, Cell);
Vue.component(CellGroup.name, CellGroup);
Cell 可以单独使用,也可以与 CellGroup 搭配使用,CellGroup 可以为 Cell 提供上下外边框。
<sf-cell-group>
<sf-cell title="单元格" value="内容" />
<sf-cell title="单元格" value="内容" label="描述信息" />
</sf-cell-group>
通过 CellGroup 的 inset 属性,可以将单元格转换为圆角卡片风格。
<sf-cell-group inset>
<sf-cell title="单元格" value="内容" />
<sf-cell title="单元格" value="内容" label="描述信息" />
</sf-cell-group>
通过 size 属性可以控制单元格的大小。
<sf-cell title="单元格" value="内容" size="large" />
<sf-cell title="单元格" value="内容" size="large" label="描述信息" />
通过 icon 属性在标题左侧展示图标。
<sf-cell title="单元格" icon="location-o" />
只设置 value 时,内容会靠左对齐。
<sf-cell value="内容" />
设置 is-link 属性后会在单元格右侧显示箭头,并且可以通过 arrow-direction 属性控制箭头方向。
<sf-cell title="单元格" is-link />
<sf-cell title="单元格" is-link value="内容" />
<sf-cell title="单元格" is-link arrow-direction="down" value="内容" />
可以通过 url 属性进行 URL 跳转,或通过 to 属性进行路由跳转。
<sf-cell title="URL 跳转" is-link url="/demo.html" />
<sf-cell title="路由跳转" is-link to="index" />
通过 CellGroup 的 title 属性可以指定分组标题。
<sf-cell-group title="分组1">
<sf-cell title="单元格" value="内容" />
</sf-cell-group>
<sf-cell-group title="分组2">
<sf-cell title="单元格" value="内容" />
</sf-cell-group>
如以上用法不能满足你的需求,可以使用插槽来自定义内容。
<sf-cell value="内容" is-link>
<!-- 使用 title 插槽来自定义标题 -->
<template #title>
<span class="custom-title">单元格</span>
<sf-tag type="danger">标签</sf-tag>
</template>
</sf-cell>
<sf-cell title="单元格" icon="shop-o">
<!-- 使用 right-icon 插槽来自定义右侧图标 -->
<template #right-icon>
<sf-icon name="search" class="search-icon" />
</template>
</sf-cell>
<style>
.custom-title {
margin-right: 4px;
vertical-align: middle;
}
.search-icon {
font-size: 16px;
line-height: inherit;
}
</style>
通过 center 属性可以让 Cell 的左右内容都垂直居中。
<sf-cell center title="单元格" value="内容" label="描述信息" />
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 分组标题 | string | - |
| border | 是否显示外边框 | boolean | true |
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 左侧标题 | number | string | - |
| value | 右侧内容 | number | string | - |
| label | 标题下方的描述信息 | string | - |
| size | 单元格大小,可选值为 large | string | - |
| icon | 左侧图标名称或图片链接 | string | - |
| icon-prefix | 图标类名前缀,同 Icon 组件的 class-prefix 属性 | string | sf-icon |
| url | 点击后跳转的链接地址 | string | - |
| to | 点击后跳转的目标路由对象,同 vue-router 的 to 属性 | string | object | - |
| border | 是否显示内边框 | boolean | true |
| replace | 是否在跳转时替换当前页面历史 | boolean | false |
| clickable | 是否开启点击反馈 | boolean | null |
| is-link | 是否展示右侧箭头并开启点击反馈 | boolean | false |
| required | 是否显示表单必填星号 | boolean | false |
| center | 是否使内容垂直居中 | boolean | false |
| arrow-direction | 箭头方向,可选值为 left up down | string | right |
| title-style | 左侧标题额外样式 | any | - |
| title-class | 左侧标题额外类名 | any | - |
| value-class | 右侧内容额外类名 | any | - |
| label-class | 描述信息额外类名 | any | - |
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| click | 点击单元格时触发 | event: Event |
| 名称 | 说明 |
|---|---|
| default | 默认插槽 |
| title | 自定义分组标题 |
| 名称 | 说明 |
|---|---|
| default | 自定义右侧 value 的内容 |
| title | 自定义左侧 title 的内容 |
| label | 自定义标题下方 label 的内容 |
| icon | 自定义左侧图标 |
| right-icon | 自定义右侧按钮,默认为arrow |
| extra | 自定义单元格最右侧的额外内容 |
组件提供了下列 Less 变量,可用于自定义样式,使用方法请参考主题定制。
| 名称 | 默认值 | 描述 |
|---|---|---|
| @cell-font-size | @font-size-md | - |
| @cell-line-height | 24px | - |
| @cell-vertical-padding | 10px | - |
| @cell-horizontal-padding | @padding-md | - |
| @cell-text-color | @text-color | - |
| @cell-background-color | @white | - |
| @cell-border-color | @border-color | - |
| @cell-active-color | @active-color | - |
| @cell-required-color | @red | - |
| @cell-label-color | @gray-6 | - |
| @cell-label-font-size | @font-size-sm | - |
| @cell-label-line-height | @line-height-sm | - |
| @cell-label-margin-top | @padding-base | - |
| @cell-value-color | @gray-6 | - |
| @cell-icon-size | 16px | - |
| @cell-right-icon-color | @gray-6 | - |
| @cell-large-vertical-padding | @padding-sm | - |
| @cell-large-title-font-size | @font-size-lg | - |
| @cell-large-label-font-size | @font-size-md | - |
| @cell-group-background-color | @white | - |
| @cell-group-title-color | @gray-6 | - |
| @cell-group-title-padding | @padding-md @padding-md @padding-xs | - |
| @cell-group-title-font-size | @font-size-md | - |
| @cell-group-title-line-height | 16px | - |
FAQs
### 介绍
The npm package @ophiuchus/cell receives a total of 4 weekly downloads. As such, @ophiuchus/cell popularity was classified as not popular.
We found that @ophiuchus/cell demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.