# 卡片-容器(Card)

卡片容器,可承载文字、列表、图片、段落等

# 示例

<template>
  <div class="page" :style="pageContainerStyle">
    <dof-minibar title="5.1 卡片容器"></dof-minibar>
    <SwitchTheme />
    <scroller class="content">
      <dof-board title="卡片布局" subtitle="三种宽度布局">
        <dof-card class="m-b-16">
          <div class="placeholder160"></div>
        </dof-card>
        <dof-row class="m-b-16">
          <dof-col>
            <dof-card>
              <div class="placeholder176"></div>
            </dof-card>
          </dof-col>
          <dof-col>
            <dof-card>
              <div class="placeholder176"></div>
            </dof-card>
          </dof-col>
        </dof-row>
        <dof-row class="m-b-16">
          <dof-col>
            <dof-card>
              <div class="placeholder218"></div>
            </dof-card>
          </dof-col>
          <dof-col>
            <dof-card>
              <div class="placeholder218"></div>
            </dof-card>
          </dof-col>
          <dof-col>
            <dof-card>
              <div class="placeholder218"></div>
            </dof-card>
          </dof-col>
        </dof-row>
        <dof-row class="m-b-16">
          <dof-col>
            <dof-card>
              <div class="placeholder160"></div>
            </dof-card>
          </dof-col>
          <dof-col>
            <dof-card>
              <div class="placeholder160"></div>
            </dof-card>
          </dof-col>
          <dof-col>
            <dof-card>
              <div class="placeholder160"></div>
            </dof-card>
          </dof-col>
          <dof-col>
            <dof-card>
              <div class="placeholder160"></div>
            </dof-card>
          </dof-col>
        </dof-row>
      </dof-board>
    </scroller>
  </div>
</template>
<script>
import { DofRow, DofCol, DofCard, DofMinibar, DofBoard } from 'dolphin-weex-ui'
import SwitchTheme from 'src/components/SwitchTheme.vue'
export default {
  beforeCreate() {
    // this.$theme.setTheme('colmo')
    // this.$bridge.setStatusBar({ colorMode: '2' })
  },
  components: {
    DofMinibar,
    DofRow,
    DofCol,
    DofCard,
    DofBoard,
    SwitchTheme
  },
  data() {
    return {
      leftButton: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/header/icon_back_white@3x.png',
      selected: false,
      collapsed: false,
      sv: 27,
      sv1: 26.5,
      cv: 1,
      cv1: 1,
      tem: 60
    }
  },
  computed: {
    pageContainerStyle() {
      try {
        let tmp = this.$theme.watchTheme({
          colmo: { backgroundColor: '#151617' }, // colmo模式 的 style
          default: { backgroundColor: '#f9f9f9' }
        })
        return tmp
      } catch (error) {
        return {}
      }
    }
  }
}
</script>

<style scoped>
.page {
  background-color: #151617;
}
.safe {
  padding-top: 88px;
}

.scroller {
  flex: 1;
}

.placeholder {
  height: 100px;
}
.placeholder160 {
  /* card 有padding: 64px; */
  height: 96px;
}
.placeholder176 {
  /* card 有padding: 64px; */
  height: 112px;
}
.placeholder218 {
  /* card 有padding: 64px; */
  height: 154px;
}

.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;
}

</style>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
点我扫二维码 查看demo

# Attributes

# 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 `` 当前卡片的值, 用于 card-group 组件单选功能

# Events

事件名 说明 回调参数
select 可选择时,点击时触发 e :Boolean
collaspe 可折叠式,点击折叠图标时触发 e: Boolean

# Slots

插槽名 说明
default 卡片内容
body 卡片可折叠时, 卡的下拉内容

# DofCardItem

# Slots

插槽名 说明
default 卡片项内容

# DofCardGroup

# Props

Prop Type Required Default Description
value(v-model) String | Number Y - 选中的值

# Events

事件名 说明 回调参数
change card 组件选中时触发 e :String | Number

# Slots

插槽名 说明
default 卡片组内容
Last Updated: 1/4/2024, 4:01:09 PM