mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
panel component
This commit is contained in:
parent
9ee6c4bf59
commit
a8bbc42cda
107
docs/examples-docs/panel.md
Normal file
107
docs/examples-docs/panel.md
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<style>
|
||||||
|
.z-panel-sum {
|
||||||
|
background: #fff;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
line-height: 30px;
|
||||||
|
padding-right: 15px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.z-panel-buttons {
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
.z-button {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
## Panel 面板
|
||||||
|
|
||||||
|
面板只是一个容器,里面可以放入自定义的内容。
|
||||||
|
|
||||||
|
### 基础用法
|
||||||
|
|
||||||
|
:::demo
|
||||||
|
```html
|
||||||
|
<z-panel title="标题" desc="标题描述" status="状态">
|
||||||
|
<z-card
|
||||||
|
title="商品名称是什么,两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余"
|
||||||
|
desc="商品SKU1,商品SKU2"
|
||||||
|
thumb="https://img.yzcdn.cn/upload_files/2017/02/17/FnDwvwHmU-OiqsbjAO5X7wh1KWrR.jpg!100x100.jpg">
|
||||||
|
<div class="z-card__row" slot="title">
|
||||||
|
<h4 class="z-card__title">商品名称是什么,两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余</h4>
|
||||||
|
<span class="z-card__price">¥ 2.00</span>
|
||||||
|
</div>
|
||||||
|
<div class="z-card__row" slot="desc">
|
||||||
|
<h4 class="z-card__desc">商品sku</h4>
|
||||||
|
<span class="z-card__num">x 2</span>
|
||||||
|
</div>
|
||||||
|
<div class="z-card__footer" slot="footer">
|
||||||
|
<z-button size="mini">按钮一</z-button>
|
||||||
|
<z-button size="mini">按钮二</z-button>
|
||||||
|
</div>
|
||||||
|
</z-card>
|
||||||
|
<div class="z-panel-sum">
|
||||||
|
合计:<span>¥ 1999.90</span>
|
||||||
|
</div>
|
||||||
|
</z-panel>
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
### 高级用法
|
||||||
|
|
||||||
|
使用具名`slot`自定义内容。
|
||||||
|
|
||||||
|
:::demo
|
||||||
|
```html
|
||||||
|
<z-panel title="标题" desc="标题描述" status="状态">
|
||||||
|
<z-card
|
||||||
|
title="商品名称是什么,两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余"
|
||||||
|
desc="商品SKU1,商品SKU2"
|
||||||
|
thumb="https://img.yzcdn.cn/upload_files/2017/02/17/FnDwvwHmU-OiqsbjAO5X7wh1KWrR.jpg!100x100.jpg">
|
||||||
|
<div class="z-card__row" slot="title">
|
||||||
|
<h4 class="z-card__title">商品名称是什么,两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余两行显示状态如效果图,多余多余多余</h4>
|
||||||
|
<span class="z-card__price">¥ 2.00</span>
|
||||||
|
</div>
|
||||||
|
<div class="z-card__row" slot="desc">
|
||||||
|
<h4 class="z-card__desc">商品sku</h4>
|
||||||
|
<span class="z-card__num">x 2</span>
|
||||||
|
</div>
|
||||||
|
<div class="z-card__footer" slot="footer">
|
||||||
|
<z-button size="mini">按钮一</z-button>
|
||||||
|
<z-button size="mini">按钮二</z-button>
|
||||||
|
</div>
|
||||||
|
</z-card>
|
||||||
|
<div class="z-panel-sum">
|
||||||
|
合计:<span>¥ 1999.90</span>
|
||||||
|
</div>
|
||||||
|
<div class="z-panel-buttons" slot="footer">
|
||||||
|
<z-button size="small">按钮一</z-button>
|
||||||
|
<z-button size="small" type="danger">按钮二</z-button>
|
||||||
|
</div>
|
||||||
|
</z-panel>
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
|
| title | 标题 | string | '' | '' |
|
||||||
|
| desc | 描述 | string | '' | '' |
|
||||||
|
| status | 状态 | string | '' | '' |
|
||||||
|
|
||||||
|
|
||||||
|
### Slot
|
||||||
|
|
||||||
|
| name | 描述 |
|
||||||
|
|-----------|-----------|
|
||||||
|
| - | 自定义内容 |
|
||||||
|
| header | 自定义header |
|
||||||
|
| footer | 自定义footer |
|
@ -18,6 +18,10 @@
|
|||||||
"path": "/progress",
|
"path": "/progress",
|
||||||
"title": "Progress"
|
"title": "Progress"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "/panel",
|
||||||
|
"title": "Panel"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "/card",
|
"path": "/card",
|
||||||
"title": "Card"
|
"title": "Card"
|
||||||
|
@ -1,11 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="z-panel">
|
<div class="z-panel">
|
||||||
|
<div class="z-panel__header">
|
||||||
|
<slot name="header">
|
||||||
|
<h4 class="z-panel__title" v-text="title"></h4>
|
||||||
|
<span class="z-panel__desc" v-if="desc" v-text="desc"></span>
|
||||||
|
<span class="z-panel__status" v-if="status" v-text="status"></span>
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
<div class="z-panel__content">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
<div class="z-panel__footer" v-if="this.$slots.footer">
|
||||||
|
<slot name="footer"></slot>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'z-panel',
|
name: 'z-panel',
|
||||||
props: []
|
props: {
|
||||||
|
title: String,
|
||||||
|
desc: String,
|
||||||
|
status: String
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
background: #FAFAFA;
|
background: #FAFAFA;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom: 10px;
|
margin-top: 10px;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@e img {
|
@e img {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -1,7 +1,36 @@
|
|||||||
@component-namespace z {
|
@component-namespace z {
|
||||||
@b panel {
|
@b panel {
|
||||||
padding: 5px 15px;
|
background: #fff;
|
||||||
background: #D8D8D8;
|
border-top: 1px solid #E5E5E5;
|
||||||
overflow: hidden;
|
border-bottom: 1px solid #E5E5E5;
|
||||||
|
|
||||||
|
@e header {
|
||||||
|
padding: 10px 15px;
|
||||||
|
position: relative;
|
||||||
|
border-bottom: 1px solid #E5E5E5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@e title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
@e desc {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
@e status {
|
||||||
|
font-size: 14px;
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 15px;
|
||||||
|
color: #FF4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
@e footer {
|
||||||
|
border-top: 1px solid #E5E5E5;
|
||||||
|
padding: 10px 15px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user