5.5 卡片-可展开收起
卡片容器,可承载文字、列表、图片、段落等。
#交互原则
多用于列表中,痛过右侧小箭头可以展开与收起更多参数/调整功能,展开后,可与其他档位组件组合使用
#基础样式
![img]()
#基础用法
<template>
<div class="page">
<dof-minibar
:left-button="leftButton"
title="卡片-可折叠卡片"
text-color="#ffffff"
background-color="rgba(38,122,255,1)"
@dofMinibarLeftButtonClicked="back"
></dof-minibar>
<scroller class="content">
<dof-board title="可折叠卡片">
<dof-card :collapsable="true" :collapsed="false">
<div class="placeholder f-r f-a-c">
<image
class="sz-48 m-r-12"
src="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/temperature.png"
></image>
<text class="txt-med f-s-32 c-333 f-w-500">设置温度</text>
</div>
<div slot="body">
<dof-card-item>
<div class="f-r f-a-c m-t-20 m-b-16">
<text class="txt-med f-s-16 c-333 f-w-500">温度类型一</text>
<text class="txt-med f-s-14 c-ddd f-w-500 m-l-6 m-r-6">|</text>
<text class="txt-med f-s-14 c-333 f-w-500">{{ sv }}℃</text>
</div>
<dof-slider v-model="sv" :min="10" :max="35" class="m-b-20">
<dof-slider-scale :value="10">10℃</dof-slider-scale>
<dof-slider-scale :value="35">35℃</dof-slider-scale>
</dof-slider>
</dof-card-item>
<dof-card-item>
<div class="f-r f-a-c m-t-20 m-b-16">
<text class="txt-med f-s-16 c-333 f-w-500">温度类型二</text>
<text class="txt-med f-s-14 c-ddd f-w-500 m-l-6 m-r-6">|</text>
<text class="txt-med f-s-14 c-333 f-w-500">{{ sv }}℃</text>
</div>
<dof-slider v-model="sv" :min="10" :max="35" class="m-b-20">
<dof-slider-scale :value="10">10℃</dof-slider-scale>
<dof-slider-scale :value="35">35℃</dof-slider-scale>
</dof-slider>
</dof-card-item>
</div>
</dof-card>
</dof-board>
</scroller>
</div>
</template>
<script>
import { DofBoard, DofCard, DofCardItem, DofSlider, DofSliderScale, DofMinibar } from 'dolphin-weex-ui'
export default {
components: {
DofBoard,
DofCard,
DofCardItem,
DofSlider,
DofSliderScale,
DofMinibar
},
data() {
return {
selected: false,
collapsed: false,
sv: 27,
sv1: 26.5,
cv: 1,
cv1: 1,
tem: 60
}
}
}
</script>
<style scoped>
.page {
background-color: #f9f9f9;
}
.safe {
padding-top: 88px;
}
.scroller {
flex: 1;
}
.placeholder {
height: 100px;
}
.caption {
flex-direction: row;
align-items: center;
}
.caption-title {
flex: 1;
font-family: PingFangSC-Regular;
font-size: 12px;
color: #666666;
text-align: center;
font-weight: 400;
text-align: left;
}
.caption-desc {
font-family: PingFangSC-Regular;
font-size: 12px;
color: #8a8a8f;
letter-spacing: 0;
text-align: right;
font-weight: 400;
}
.caption-arrow {
width: 16px;
height: 16px;
margin-left: 4px;
}
.caption-o {
margin-bottom: 16px;
flex-direction: row;
align-items: center;
}
.caption-o-title {
flex: 1;
font-family: PingFangSC-Semibold;
font-size: 18px;
color: #333333;
letter-spacing: 0;
font-weight: 600;
}
.caption-o-desc {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #8a8a8f;
letter-spacing: 0;
text-align: right;
font-weight: 400;
}
.f-r {
flex-direction: row;
}
.f-a-c {
align-items: center;
}
.f-a-s {
align-items: flex-start;
}
.f-a-e {
align-items: flex-end;
}
.f-j-s {
justify-content: flex-start;
}
.f-j-c {
justify-content: center;
}
.f-j-e {
justify-content: flex-end;
}
.f-1 {
flex: 1;
}
.m-l-n-16 {
margin-left: -16px;
}
.m-r-n-16 {
margin-right: -16px;
}
.m-l-6 {
margin-left: 6px;
}
.m-r-6 {
margin-right: 6px;
}
.m-r-4 {
margin-right: 4px;
}
.m-r-15 {
margin-right: 15px;
}
.m-b-1 {
margin-bottom: 1px;
}
.m-b-2 {
margin-bottom: 2px;
}
.m-b-3 {
margin-bottom: 3px;
}
.m-b-4 {
margin-bottom: 4px;
}
.m-b-5 {
margin-bottom: 5px;
}
.m-b-6 {
margin-bottom: 6px;
}
.m-b-8 {
margin-bottom: 8px;
}
.m-b-10 {
margin-bottom: 10px;
}
.m-b-12 {
margin-bottom: 12px;
}
.m-b-16 {
margin-bottom: 16px;
}
.m-b-20 {
margin-bottom: 20px;
}
.m-b-25 {
margin-bottom: 25px;
}
.m-b-30 {
margin-bottom: 30px;
}
.m-b-32 {
margin-bottom: 32px;
}
.m-t-8 {
margin-top: 8px;
}
.m-t-12 {
margin-top: 12px;
}
.m-t-20 {
margin-top: 20px;
}
.p-b-3 {
padding-bottom: 3px;
}
.h-76 {
height: 76px;
}
.h-84 {
height: 84px;
}
.h-90 {
height: 90px;
}
.h-108 {
height: 108px;
}
.h-147 {
height: 147px;
}
.sz-32 {
width: 32px;
height: 32px;
}
.sz-48 {
width: 48px;
height: 48px;
}
.p-l-16 {
padding-left: 16px;
}
.p-r-16 {
padding-right: 16px;
}
.p-hor-16 {
padding-left: 16px;
padding-right: 16px;
}
.txt-med {
font-family: PingFangSC-Medium;
}
.txt {
font-family: PingFangSC-Regular;
}
.txt-bold {
font-family: DINAlternate-Bold;
}
.c-000 {
color: #000000;
}
.c-333 {
color: #333333;
}
.c-666 {
color: #666666;
}
.c-8a {
color: #8a8a8f;
}
.c-ddd {
color: #dddddd;
}
.f-s-10 {
font-size: 10px;
}
.f-s-12 {
font-size: 12px;
}
.f-s-16 {
font-size: 16px;
}
.f-s-22 {
font-size: 22px;
}
.f-s-32 {
font-size: 32px;
}
.f-s-36 {
font-size: 36px;
}
.f-s-72 {
font-size: 72px;
}
.f-w-400 {
font-weight: 400;
}
.f-w-500 {
font-weight: 500;
}
.f-w-700 {
font-weight: 700;
}
.b-r {
border-right-color: #f2f2f2;
border-right-style: solid;
border-right-width: 1px;
}
.b-b {
border-bottom-color: #f2f2f2;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.btn {
background-color: rgba(38, 122, 255, 0.1);
border-radius: 12px;
width: 64px;
height: 24px;
align-items: center;
justify-content: center;
}
.btn-text {
font-family: PingFangSC-Medium;
font-size: 12px;
color: #267aff;
text-align: right;
font-weight: 500;
}
.press-btn:active {
background-color: #f2f2f2;
}
</style>
#Api
#Props
| Prop |
Type |
Required |
Default |
Description |
| collapsable |
Boolean |
N |
false |
是否可折叠 |
| collapsed |
Boolean |
N |
false |
是否折叠 |
| selectable |
Boolean |
N |
false |
是否可选择 |
| selected (v-model) |
Boolean |
N |
false |
是否选中 |
| tag |
String |
N |
right |
选中时,展示的图标的位置 |
| value |
`String |
Number` |
N |
`` |
#Events
| 事件名 |
说明 |
回调参数 |
select |
可选择时,点击时触发 |
e :Boolean |
collaspe |
可折叠式,点击折叠图标时触发 |
e: Boolean |
#Slots
| 插槽名 |
说明 |
| default |
卡片内容 |
| body |
卡片可折叠时, 卡的下拉内容 |
#DofCardItem
#Slots
#DofCardGroup
#Props
| Prop |
Type |
Required |
Default |
Description |
| value(v-model) |
`String |
Number` |
Y |
- |
#Events
| 事件名 |
说明 |
回调参数 |
change |
card 组件选中时触发 |
e :`String |
#Slots