# 滑块

用于设备挡位控制

# 实例

# 基础用法

<template>
  <div class="page">
    <scroller class="content">
      <dof-board title="基本用法">
        <dof-gear :value="60" v-model="gear"></dof-gear>
      </dof-board>
      <dof-board title="可编辑">
        <dof-card>
          <div>
            <text class="txt f-s-16 c-666">挡位: {{ gear1 }}</text>
          </div>
          <dof-gear :value="56" :height="128" v-model="gear1" :readonly="false" set-color="#000000"></dof-gear>
        </dof-card>
      </dof-board>
      <dof-board title="可滑动">
        <dof-card>
          <div>
            <text class="txt f-s-16 c-666">挡位: {{ gear1 }}</text>
          </div>
          <dof-gear :swipable="true" :value="56" :height="128" v-model="gear1" :readonly="false" set-color="#000000"></dof-gear>
        </dof-card>
      </dof-board>
    </scroller>
  </div>
</template>

<script>
import { DofBoard, DofGear, DofCard } from 'dolphin-weex-ui'
export default {
  components: {
    DofBoard,
    DofGear,
    DofCard
  },
  data() {
    return {
      gear: 3,
      gear1: 4
    }
  }
}
</script>

<style scoped>
.page {
  padding-top: 44px;
  background-color: #f9f9f9;
}

.safe {
  padding-top: 88px;
}

.scroller {
  flex: 1;
}

.placeholder {
  flex: 1;
  min-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-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-25 {
  margin-bottom: 25px;
}

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

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

.m-t-8 {
  margin-top: 8px;
}

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

.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-36 {
  font-size: 36px;
}

.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;
}
</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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348

# Api

# Slider

# Props

参数 说明 类型 默认值 是否必须
value 当前值 number 0
gear(v-model) 当前挡位 number 0
bar-width 矩形宽度 number 16 -
height 矩形高度 number #f2f2f2 -
color 矩形默认颜色 string brand -
full-color 当值大于矩形对应的值时,矩形的颜色 string #1A4FB6 -
set-color 设置的挡位颜色 string #FF3B30 -
ranges 矩形对应的值范围 array 默认为国际组件对应的值 -
readonly 是否为只读状态 boolean `` true
grow 设置挡位对应的矩形,相对于普通矩形的增长高度 number 42 -
swipable 是否可滑动选择挡位 boolean false -

# Events

事件名称 说明 回调参数
change 非只读模式下,挡位变动触发 e: Number
Last Updated: 4/13/2022, 3:19:30 PM