# 5.4 卡片-图标

当设备有较多简单模式选择操作时,推荐使用此控件样式

# 交互原则

点击icon即可开关对应模式,若有二级更多参数调整,可通过弹窗或页面进行调整后,在对应功能 icon 或名称上有变化,符合可直观查看状态的交互目标

# 基础样式

# 示例

# colmo风格示例

# 实例

# 基础用法


<template>
  <div class="page">
    <dof-minibar
      :left-button="leftButton"
      title="卡片-图标"
      text-color="#ffffff"
      background-color="rgba(38,122,255,1)"
      @dofMinibarLeftButtonClicked="back"
    ></dof-minibar>
    <dof-tab-page
      type="primary"
      slot="middle"
      :is-slot="false"
      ref="dof-tab-page"
      :tab-titles="[{ title: '通用' }, { title: 'COLMO' }]"
      :tab-checked-index="activeTab"
      @dofTabSelected="tabChangeHandler"
    ></dof-tab-page>
    <slider
      class="slider"
      :index="activeTab"
      auto-play="false"
      :infinite="false"
      @change="tabChangeHandler"
      :style="{ height: deviceHeight - 200 + 'px' }"
    >
      <scroller class="scroller" :style="{ height: deviceHeight - 200 + 'px' }">
        <dof-board title="标题">
          <dof-card class="m-b-20">
            <dof-row class="m-l-n-16 m-r-n-16">
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv1"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/leaf.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/leaf-t.png"
                  text="新风"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv2"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/audio.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/audio-t.png"
                  text="上下风"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv3"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-t.png"
                  text="上左右风"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv4"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-bb.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-bb-t.png"
                  text="下左右风"
                ></dof-icon-button>
              </dof-col>
            </dof-row>
          </dof-card>
          <dof-card>
            <dof-row class="m-l-n-16 m-r-n-16 m-b-40">
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv5"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/fan-t.png"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/fan.png"
                  text="风速"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv6"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/audio-t.png"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/audio.png"
                  text="上下风"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv7"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-t.png"
                  text="上左右风"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv8"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-bb.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-bb-t.png"
                  text="下左右风"
                ></dof-icon-button>
              </dof-col>
            </dof-row>
            <dof-row class="m-l-n-16 m-r-n-16">
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv9"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-v-t.png"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-v.png"
                  text="上无风感"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv10"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-back.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/air-back-t.png"
                  text="下无风感"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv11"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/people.png"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/people-t.png"
                  text="智能风感"
                ></dof-icon-button>
              </dof-col>
              <dof-col class="f-a-c">
                <dof-icon-button
                  v-model="iv12"
                  active-img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/child-t.png"
                  img="http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/child.png"
                  text="儿童防冷风"
                ></dof-icon-button>
              </dof-col>
            </dof-row>
          </dof-card>
        </dof-board>
      </scroller>
      <scroller class="scroller" :style="{ height: deviceHeight - 200 + 'px' }">
        <div class="showItem" style="background-color: black;">
          <dof-icon-button
            v-model="iv1"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
            :isHapticFeedback="true"
            :isFeedbackTouch="true"
          ></dof-icon-button>
          <dof-icon-button
            v-model="iv2"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
          ></dof-icon-button>
          <dof-icon-button
            v-model="iv1"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :isShowTriangle="true"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
          ></dof-icon-button>
          <dof-icon-button
            v-model="iv2"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :isShowTriangle="true"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
          ></dof-icon-button>
        </div>
        <div class="showItem" style="background-color: black;">
          <dof-icon-button
            v-model="iv1"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
            :touchColor="'#71717A'"
            :isLoading="true"
            :loadingImg="'white'"
          ></dof-icon-button>
          <dof-icon-button
            v-model="iv2"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
            :touchColor="'#71717A'"
            :isLoading="true"
            :loadingImg="'white'"
          ></dof-icon-button>
          <dof-icon-button
            v-model="iv1"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :isShowTriangle="true"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
            :touchColor="'#71717A'"
            :isLoading="true"
            :loadingImg="'white'"
          ></dof-icon-button>
          <dof-icon-button
            v-model="iv2"
            :img="img"
            :active-img="activeImg"
            text="功能"
            :isShowTriangle="true"
            :textColor="'#fff'"
            color="#000"
            activeColor="#000"
            :borderColor="'rgba(113,113,122,1)'"
            :activeBorderColor="'#B35336'"
            :isFeedbackTouch="true"
            :touchColor="'#71717A'"
            :isLoading="true"
            :loadingImg="'white'"
          ></dof-icon-button>
        </div>
      </scroller>
    </slider>
  </div>
</template>

<script>
import { DofBoard, DofRow, DofCol, DofCard, DofIconButton, DofMinibar, DofTabPage } from 'dolphin-weex-ui'
export default {
  components: {
    DofBoard,
    DofRow,
    DofCol,
    DofCard,
    DofIconButton,
    DofMinibar,
    DofTabPage
  },
  data() {
    return {
      leftButton: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/header/icon_back_white@3x.png',
      iv1: true,
      iv2: true,
      iv3: false,
      iv4: false,
      iv5: true,
      iv6: true,
      iv7: false,
      iv8: false,
      iv9: true,
      iv10: false,
      iv11: false,
      iv12: true,
      img: 'http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/leaf.png',
      activeImg: 'http://dolphin-weex-dev.msmartlife.cn/static/component/card/image/leaf-t.png',
      activeTab: 0,
      deviceHeight: weex.config.env.deviceHeight
    }
  },
  methods: {
    tabChangeHandler(val) {
      this.activeTab = val.index
    }
  }
}
</script>

<style scoped>
.page {
  background-color: #f9f9f9;
}
.slider {
  width: 750px;
}
.scroller {
  width: 750px;
}

.f-a-c {
  align-items: center;
}

.m-l-n-16 {
  margin-left: -16px;
}

.m-r-n-16 {
  margin-right: -16px;
}

.m-b-20 {
  margin-bottom: 20px;
}

.showItem {
  padding-top: 30px;
  padding-bottom: 30px;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}
</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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331

# Api

# Props

Prop Type Required Default Description
active Boolean N false 是否激活态
img String Y `` 常态图标
activeImg String Y `` 选中态图片
color String N #f2f2f2 常态背景颜色
activeColor String N #267AFF 选中态背景颜色
text String N `` 图标按钮下方文字
textColor String N #000 字体颜色
isFeedbackTouch Boolean N false 是否开启点击未松手更换背景颜色
touchColor String N #d9d9d9 点击未动手背景颜色,isFeedbackTouch为true生效
isLoading Boolean N false 是否是loading状态
loadingImg String N black black/white
isShowTriangle Boolean N false 是否展示图标右下角三角
borderColor String N transparent 常态边框颜色
activeBorderColor String N transparent 选中态背景颜色
isHapticFeedback Boolean N false 是否开启手机震动反馈
btnSize Number N 96 按钮大小
imgSize Number N 96 图片大小
loadingImgSize Number N 32 loading图片大小
disabled Boolean N false 是否禁用

# Events

事件名 说明 回调参数
change 点击时触发 e :Boolean

# Slots

插槽名 说明
default 卡片下方文案
Last Updated: 7/20/2023, 2:20:51 PM