mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
cell component
This commit is contained in:
parent
18d5372ddb
commit
35ec796e61
@ -1,15 +1,26 @@
|
|||||||
## Cell 组件
|
## Cell 组件
|
||||||
|
|
||||||
|
### 基础用法
|
||||||
|
|
||||||
|
:::demo 样例代码
|
||||||
|
```html
|
||||||
|
<o2-cell title="单元格" value="单元格标题"></o2-cell>
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| className | 自定义额外类名 | string | '' | '' |
|
| icon | 左侧图标 | string | '' | '' |
|
||||||
|
| title | 左侧标题 | string | '' | '' |
|
||||||
|
| value | 右侧内容 | string | '' | '' |
|
||||||
|
| isLink | 是否为链接,链接会在右侧出现箭头 | string | '' | '' |
|
||||||
|
|
||||||
### Slot
|
### Slot
|
||||||
|
|
||||||
| name | 描述 |
|
| name | 描述 |
|
||||||
|-----------|-----------|
|
|-----------|-----------|
|
||||||
| - | 自定义显示内容 |
|
| - | 自定义显示内容 |
|
||||||
| icon | |
|
| icon | 自定义icon |
|
||||||
| name | |
|
| title | 自定义title |
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="o2-cell">
|
<a class="o2-cell" :href="url">
|
||||||
<div class="o2-cell-title">
|
<div class="o2-cell-title">
|
||||||
<slot name="icon">
|
<slot name="icon">
|
||||||
<i v-if="icon" class="o2-icon" :class="'o2-icon-' + icon"></i>
|
<i v-if="icon" class="o2-icon" :class="'o2-icon-' + icon"></i>
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="title">
|
<slot name="title">
|
||||||
|
<span class="o2-cell-text" v-text="title"></span>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="o2-cell-value">
|
<div class="o2-cell-value">
|
||||||
<slot>
|
<slot>
|
||||||
|
<span v-text="value"></span>
|
||||||
</slot>
|
</slot>
|
||||||
|
<i class="o2-cell-arrow-right" v-if="isLink"></i>
|
||||||
</div>
|
</div>
|
||||||
<i class="o2-cell-arrow-right"></i>
|
</a>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -22,7 +23,26 @@ export default {
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
icon: String,
|
icon: String,
|
||||||
title: String
|
title: String,
|
||||||
|
value: String,
|
||||||
|
url: String,
|
||||||
|
isLink: Boolean
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@component-namespace o2 {
|
||||||
|
@component cell {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
@descendent title {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
@descendent value {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -4,6 +4,7 @@ import Switch from '../packages/switch/index.js';
|
|||||||
import Field from '../packages/field/index.js';
|
import Field from '../packages/field/index.js';
|
||||||
import Radio from '../packages/radio/index.js';
|
import Radio from '../packages/radio/index.js';
|
||||||
import Cell from '../packages/cell/index.js';
|
import Cell from '../packages/cell/index.js';
|
||||||
|
import Icon from '../packages/icon/index.js';
|
||||||
// zenui
|
// zenui
|
||||||
import '../packages/zenui/src/index.pcss';
|
import '../packages/zenui/src/index.pcss';
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ const install = function(Vue) {
|
|||||||
Vue.component(Field.name, Field);
|
Vue.component(Field.name, Field);
|
||||||
Vue.component(Radio.name, Radio);
|
Vue.component(Radio.name, Radio);
|
||||||
Vue.component(Cell.name, Cell);
|
Vue.component(Cell.name, Cell);
|
||||||
|
Vue.component(Icon.name, Icon);
|
||||||
};
|
};
|
||||||
|
|
||||||
// auto install
|
// auto install
|
||||||
@ -31,5 +33,6 @@ module.exports = {
|
|||||||
Switch,
|
Switch,
|
||||||
Field,
|
Field,
|
||||||
Radio,
|
Radio,
|
||||||
Cell
|
Cell,
|
||||||
|
Icon
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user