dolphin-weex-ui 0.2.13 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/index.native.js +3802 -1588
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.js +4388 -1726
- package/dist/index.web.js.map +1 -1
- package/index.js +24 -0
- package/package.json +1 -1
- package/packages/dof-board/index.js +1 -0
- package/packages/dof-board/index.vue +63 -0
- package/packages/dof-card/index.js +1 -1
- package/packages/dof-card/index.vue +138 -411
- package/packages/dof-card-group/index.js +1 -0
- package/packages/dof-card-group/index.vue +18 -0
- package/packages/dof-card-item/index.js +1 -0
- package/packages/dof-card-item/index.vue +24 -0
- package/packages/dof-col/index.js +1 -0
- package/packages/dof-col/index.vue +34 -0
- package/packages/dof-gear/index.js +1 -0
- package/packages/dof-gear/index.vue +206 -0
- package/packages/dof-gear/range.js +26 -0
- package/packages/dof-icon-button/index.js +1 -0
- package/packages/dof-icon-button/index.vue +88 -0
- package/packages/dof-progress/index.vue +53 -56
- package/packages/dof-row/index.js +1 -0
- package/packages/dof-row/index.vue +21 -0
- package/packages/dof-slider/index.js +1 -0
- package/packages/dof-slider/index.vue +251 -0
- package/packages/dof-slider-scale/index.js +1 -0
- package/packages/dof-slider-scale/index.vue +52 -0
- package/packages/dof-step-action/index.js +1 -0
- package/packages/dof-step-action/index.vue +113 -0
- package/packages/dof-switch/index.vue +45 -7
- package/packages/dof-tag/index.js +1 -1
- package/packages/dof-tag/index.vue +56 -127
- package/packages/dof-tag-group/index.js +1 -0
- package/packages/dof-tag-group/index.vue +19 -0
- package/packages/dof-taged/index.js +1 -0
- package/packages/dof-taged/index.vue +140 -0
- package/packages/utils/direction.js +7 -0
- package/packages/utils/dom.js +11 -0
- package/packages/utils/math-extension.js +3 -0
- package/packages/utils/mix-child.js +57 -0
- package/packages/utils/mix-parent.js +14 -0
- package/packages/utils/mix-selectable-child.js +69 -0
- package/packages/utils/mix-selectable-parent.js +29 -0
- package/packages/utils/touch.js +76 -0
- package/packages/utils/transition.js +130 -0
- package/packages/utils/vue-extension.js +32 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dof-slider">
|
|
3
|
+
<div class="dof-slider-track" ref="track" :style="trackStyle">
|
|
4
|
+
<div
|
|
5
|
+
:class="['dof-slider-bar', `dof-slider-bar--${this.theme}`]"
|
|
6
|
+
@touchstart="onTouchStart"
|
|
7
|
+
@touchmove="onTouchMove"
|
|
8
|
+
@touchend="onTouchEnd"
|
|
9
|
+
:style="barStyle"
|
|
10
|
+
>
|
|
11
|
+
<div class="dof-slider-button" :style="buttonStyle"></div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="dof-slider-scales" v-if="$slots.default">
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { getBoundingClientRect } from '../utils/dom.js'
|
|
22
|
+
import { clamp } from '../utils/math-extension.js'
|
|
23
|
+
import { Touch } from '../utils/touch.js'
|
|
24
|
+
export default {
|
|
25
|
+
props: {
|
|
26
|
+
value: {
|
|
27
|
+
type: Number,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
min: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 0
|
|
33
|
+
},
|
|
34
|
+
max: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 100
|
|
37
|
+
},
|
|
38
|
+
step: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 1
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
readonly: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
trackHeight: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 40
|
|
53
|
+
},
|
|
54
|
+
trackColor: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '#F2F2F2'
|
|
57
|
+
},
|
|
58
|
+
theme: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'brand'
|
|
61
|
+
},
|
|
62
|
+
barColor: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: ''
|
|
65
|
+
},
|
|
66
|
+
buttonColor: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '#ffffff'
|
|
69
|
+
},
|
|
70
|
+
buttonSize: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 24
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
model: {
|
|
76
|
+
prop: 'value',
|
|
77
|
+
event: 'input'
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
touch: Touch.Create(),
|
|
82
|
+
current: 0,
|
|
83
|
+
startValue: 0,
|
|
84
|
+
dragStatus: '',
|
|
85
|
+
width: 0
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
computed: {
|
|
89
|
+
scope() {
|
|
90
|
+
return this.max - this.min
|
|
91
|
+
},
|
|
92
|
+
interactive() {
|
|
93
|
+
return !this.disabled && !this.readonly
|
|
94
|
+
},
|
|
95
|
+
trackStyle() {
|
|
96
|
+
const res = {
|
|
97
|
+
height: `${this.trackHeight}px`,
|
|
98
|
+
backgroundColor: this.trackColor,
|
|
99
|
+
borderRadius: `${this.trackHeight / 2}px`
|
|
100
|
+
}
|
|
101
|
+
return res
|
|
102
|
+
},
|
|
103
|
+
barStyle() {
|
|
104
|
+
const width = ((this.value - this.min) / this.scope) * this.width
|
|
105
|
+
const res = {
|
|
106
|
+
width: `${clamp(width, this.trackHeight, this.width)}px`,
|
|
107
|
+
borderRadius: `${this.trackHeight / 2}px`,
|
|
108
|
+
height: `${this.trackHeight}px`
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (this.barColor) {
|
|
112
|
+
res.backgroundColor = this.barColor
|
|
113
|
+
}
|
|
114
|
+
return res
|
|
115
|
+
},
|
|
116
|
+
buttonStyle() {
|
|
117
|
+
const res = {
|
|
118
|
+
top: `${(this.trackHeight - this.buttonSize) / 2}px`,
|
|
119
|
+
right: `${(this.trackHeight - this.buttonSize) / 2}px`,
|
|
120
|
+
width: `${this.buttonSize}px`,
|
|
121
|
+
height: `${this.buttonSize}px`,
|
|
122
|
+
borderRadius: `${this.buttonSize / 2}px`,
|
|
123
|
+
backgroundColor: this.buttonColor
|
|
124
|
+
}
|
|
125
|
+
return res
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
mounted() {
|
|
129
|
+
getBoundingClientRect(this.$refs.track, res => {
|
|
130
|
+
if (res.result) {
|
|
131
|
+
this.width = res.size.width
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
onTouchStart(e) {
|
|
137
|
+
if (!this.interactive) {
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.touch.start(e)
|
|
142
|
+
this.current = this.value
|
|
143
|
+
|
|
144
|
+
this.startValue = this.format(this.current)
|
|
145
|
+
this.dragStatus = 'start'
|
|
146
|
+
},
|
|
147
|
+
onTouchMove(e) {
|
|
148
|
+
if (!this.interactive) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (this.dragStatus === 'start') {
|
|
153
|
+
this.$emit('dragstart', e)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.touch.move(e)
|
|
157
|
+
this.dragStatus = 'draging'
|
|
158
|
+
|
|
159
|
+
const delta = this.touch.deltaX
|
|
160
|
+
const total = this.width
|
|
161
|
+
const diff = (delta / total) * this.scope
|
|
162
|
+
|
|
163
|
+
this.current = this.startValue + diff
|
|
164
|
+
|
|
165
|
+
this.update(this.current)
|
|
166
|
+
},
|
|
167
|
+
onTouchEnd(e) {
|
|
168
|
+
if (!this.interactive) {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (this.dragStatus === 'draging') {
|
|
173
|
+
this.update(this.current, true)
|
|
174
|
+
this.$emit('dragend', e)
|
|
175
|
+
}
|
|
176
|
+
this.dragStatus = ''
|
|
177
|
+
},
|
|
178
|
+
format(value) {
|
|
179
|
+
const min = +this.min
|
|
180
|
+
const max = +this.max
|
|
181
|
+
const step = +this.step
|
|
182
|
+
|
|
183
|
+
const val = clamp(value, min, max)
|
|
184
|
+
const diff = Math.round((val - min) / step) * step
|
|
185
|
+
|
|
186
|
+
return min + diff
|
|
187
|
+
},
|
|
188
|
+
update(value, end = false) {
|
|
189
|
+
const val = this.format(value)
|
|
190
|
+
if (val !== this.value) {
|
|
191
|
+
this.$emit('input', val)
|
|
192
|
+
}
|
|
193
|
+
if (end && val !== this.startValue) {
|
|
194
|
+
this.$emit('change', val)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<style scoped>
|
|
202
|
+
.dof-slider {
|
|
203
|
+
flex-direction: column;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.dof-slider-track {
|
|
207
|
+
position: relative;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.dof-slider-bar {
|
|
211
|
+
position: relative;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.dof-slider-bar--brand {
|
|
215
|
+
background-color: #267aff;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.dof-slider-bar--purple {
|
|
219
|
+
background-color: #995efc;
|
|
220
|
+
}
|
|
221
|
+
.dof-slider-bar--blue-purple {
|
|
222
|
+
background-color: #6575ff;
|
|
223
|
+
}
|
|
224
|
+
.dof-slider-bar--blue {
|
|
225
|
+
background-color: #29c3ff;
|
|
226
|
+
}
|
|
227
|
+
.dof-slider-bar--cyan {
|
|
228
|
+
background-color: #00cbb8;
|
|
229
|
+
}
|
|
230
|
+
.dof-slider-bar--yellow {
|
|
231
|
+
background-color: #ffaa10;
|
|
232
|
+
}
|
|
233
|
+
.dof-slider-bar--orange {
|
|
234
|
+
background-color: #ff8225;
|
|
235
|
+
}
|
|
236
|
+
.dof-slider-bar--orange-red {
|
|
237
|
+
background-color: #ff6a4c;
|
|
238
|
+
}
|
|
239
|
+
.dof-slider-bar--gray-offline {
|
|
240
|
+
background-color: #7c879b;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.dof-slider-button {
|
|
244
|
+
position: absolute;
|
|
245
|
+
}
|
|
246
|
+
.dof-slider-scales {
|
|
247
|
+
position: relative;
|
|
248
|
+
margin-top: 16px;
|
|
249
|
+
height: 24px;
|
|
250
|
+
}
|
|
251
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './index.vue'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<text
|
|
3
|
+
:class="['dof-slider-scale', !isFirst && !isLast && 'dof-slider-scale--mid', isLast && `dof-slider-scale--last`]"
|
|
4
|
+
:style="style"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</text>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
isLast() {
|
|
20
|
+
return this.value >= this.$parent.max
|
|
21
|
+
},
|
|
22
|
+
isFirst() {
|
|
23
|
+
return this.value <= this.$parent.min
|
|
24
|
+
},
|
|
25
|
+
style() {
|
|
26
|
+
const style = {}
|
|
27
|
+
const left = ((this.value - this.$parent.min) / this.$parent.scope) * this.$parent.width
|
|
28
|
+
style.left = `${left}px`
|
|
29
|
+
return style
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style scoped>
|
|
36
|
+
.dof-slider-scale {
|
|
37
|
+
position: absolute;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
font-family: PingFangSC-Regular;
|
|
40
|
+
font-size: 20px;
|
|
41
|
+
color: #8a8a8f;
|
|
42
|
+
font-weight: 400;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dof-slider-scale--mid {
|
|
46
|
+
transform: translate(-50%, 0px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dof-slider-scale--last {
|
|
50
|
+
transform: translate(-100%, 0px);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './index.vue'
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dof-step-action" :style="style">
|
|
3
|
+
<div @click="onSubClick">
|
|
4
|
+
<slot name="sub">
|
|
5
|
+
<image
|
|
6
|
+
src="http://dolphin-weex-dev.msmartlife.cn/static/component/step-action/image/sub.png"
|
|
7
|
+
:style="btnStyle"
|
|
8
|
+
></image>
|
|
9
|
+
</slot>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="dof-step-action-container">
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</div>
|
|
14
|
+
<div @click="onAddClick">
|
|
15
|
+
<slot name="add">
|
|
16
|
+
<image
|
|
17
|
+
src="http://dolphin-weex-dev.msmartlife.cn/static/component/step-action/image/add.png"
|
|
18
|
+
:style="btnStyle"
|
|
19
|
+
></image>
|
|
20
|
+
</slot>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
export default {
|
|
27
|
+
props: {
|
|
28
|
+
height: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 40
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '#f2f2f2'
|
|
35
|
+
},
|
|
36
|
+
vertical: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
max: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 100
|
|
43
|
+
},
|
|
44
|
+
min: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 0
|
|
47
|
+
},
|
|
48
|
+
step: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 1
|
|
51
|
+
},
|
|
52
|
+
value: {
|
|
53
|
+
type: Number,
|
|
54
|
+
required: true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
model: {
|
|
58
|
+
prop: 'value',
|
|
59
|
+
event: 'change'
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
style() {
|
|
63
|
+
const res = {}
|
|
64
|
+
if (this.vertical) {
|
|
65
|
+
switch (this.vertical) {
|
|
66
|
+
case 'top':
|
|
67
|
+
res.alignItems = 'flex-start'
|
|
68
|
+
break
|
|
69
|
+
case 'middle':
|
|
70
|
+
res.alignItems = 'center'
|
|
71
|
+
break
|
|
72
|
+
case 'bottom':
|
|
73
|
+
res.alignItems = 'flex-end'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return res
|
|
77
|
+
},
|
|
78
|
+
btnStyle() {
|
|
79
|
+
const res = {
|
|
80
|
+
width: `${this.height}px`,
|
|
81
|
+
height: `${this.height}px`,
|
|
82
|
+
borderRadius: `${this.height / 2}px`,
|
|
83
|
+
backgroundColor: this.color
|
|
84
|
+
}
|
|
85
|
+
return res
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
onSubClick() {
|
|
90
|
+
const value = Math.max(this.value - this.step, this.min)
|
|
91
|
+
this.$emit('change', value)
|
|
92
|
+
this.$emit('sub')
|
|
93
|
+
},
|
|
94
|
+
onAddClick() {
|
|
95
|
+
const value = Math.min(this.value + this.step, this.max)
|
|
96
|
+
this.$emit('change', value)
|
|
97
|
+
this.$emit('add')
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style scoped>
|
|
104
|
+
.dof-step-action {
|
|
105
|
+
flex-direction: row;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.dof-step-action-container {
|
|
109
|
+
flex: 1;
|
|
110
|
+
padding-left: 16px;
|
|
111
|
+
padding-right: 16px;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<div class="dof-switch-wrapper">
|
|
3
|
+
<midea-apng-view
|
|
4
|
+
:src="loadingSrc"
|
|
5
|
+
class="dof-switch-loading"
|
|
6
|
+
resize="contain"
|
|
7
|
+
v-if="loading"
|
|
8
|
+
quality="original"
|
|
9
|
+
:auto="true"
|
|
10
|
+
:loop="true"
|
|
11
|
+
></midea-apng-view>
|
|
12
|
+
<div
|
|
13
|
+
v-else
|
|
14
|
+
ref="switch"
|
|
15
|
+
@click="changeHandler"
|
|
16
|
+
:class="[type === 'white' ? 'switch-white' : 'switch', checked && switchActiveClass]"
|
|
17
|
+
:style="mrSwitchStyle"
|
|
18
|
+
>
|
|
19
|
+
<div ref="switchDot" :style="dotStyle" :class="[type === 'white' ? 'switch-white-dot' : 'switch-dot']"></div>
|
|
20
|
+
</div>
|
|
9
21
|
</div>
|
|
10
22
|
</template>
|
|
11
23
|
|
|
12
24
|
<style scoped>
|
|
25
|
+
.dof-switch-wrapper {
|
|
26
|
+
width: 96px;
|
|
27
|
+
height: 48px;
|
|
28
|
+
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dof-switch-loading {
|
|
34
|
+
width: 32px;
|
|
35
|
+
height: 32px;
|
|
36
|
+
}
|
|
37
|
+
|
|
13
38
|
.switch {
|
|
14
39
|
width: 96px;
|
|
15
40
|
height: 48px;
|
|
@@ -117,9 +142,22 @@ module.exports = {
|
|
|
117
142
|
disabled: {
|
|
118
143
|
type: Boolean,
|
|
119
144
|
default: false
|
|
145
|
+
},
|
|
146
|
+
loading: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false
|
|
149
|
+
},
|
|
150
|
+
isLightLoading: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: false
|
|
120
153
|
}
|
|
121
154
|
},
|
|
122
155
|
computed: {
|
|
156
|
+
loadingSrc() {
|
|
157
|
+
return this.isLightLoading
|
|
158
|
+
? 'http://dolphin-weex-dev.msmartlife.cn/static/component/loading/image/loading-white.png'
|
|
159
|
+
: 'http://dolphin-weex-dev.msmartlife.cn/static/component/loading/image/loading-gray.png'
|
|
160
|
+
},
|
|
123
161
|
switchActiveClass() {
|
|
124
162
|
const { type } = this
|
|
125
163
|
return `switch-active-${type}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './index.vue'
|
|
1
|
+
export { default } from './index.vue'
|
|
@@ -1,140 +1,69 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<text class="tag-text" :style="{color:fontColor}">{{value}}</text>
|
|
7
|
-
</div>
|
|
8
|
-
<image v-if="showImage"
|
|
9
|
-
:src="img"
|
|
10
|
-
@load="onLoad"
|
|
11
|
-
:aria-hidden="true"
|
|
12
|
-
:style="{ width: imgWidth+'px'}"
|
|
13
|
-
class="tag-image"></image>
|
|
14
|
-
<div class="tag-special tag-border"
|
|
15
|
-
:style="{borderColor:tagColor}"
|
|
16
|
-
:accessible="true"
|
|
17
|
-
:aria-label="value"
|
|
18
|
-
v-if="showSpecial">
|
|
19
|
-
<div class="tag-left" :style="{backgroundColor:tagColor}">
|
|
20
|
-
<image :src="specialIcon" class="left-image"></image>
|
|
21
|
-
</div>
|
|
22
|
-
<text class="tag-text" :style="{color:fontColor}">{{value}}</text>
|
|
23
|
-
</div>
|
|
2
|
+
<div :class="['dof-tag', isActive ? 'dof-tag--active' : 'dof-tag--normal']" @click="onClick">
|
|
3
|
+
<text :class="['dof-tag-text', isActive ? 'dof-tag-text--active' : 'dof-tag-text--normal']">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</text>
|
|
24
6
|
</div>
|
|
25
7
|
</template>
|
|
26
8
|
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
height: 24px;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
align-items: center;
|
|
32
|
-
/* hack高度不居中问题,后续版本升级去掉 */
|
|
33
|
-
padding-bottom: 2px;
|
|
34
|
-
}
|
|
9
|
+
<script>
|
|
10
|
+
import { mixSelectableChild } from '../utils//mix-selectable-child.js'
|
|
35
11
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
12
|
+
export default {
|
|
13
|
+
mixins: [mixSelectableChild('dof-tag-group')],
|
|
14
|
+
props: {
|
|
15
|
+
active: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
model: {
|
|
21
|
+
prop: 'active',
|
|
22
|
+
event: 'change'
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
isActive() {
|
|
26
|
+
return this.active || this.isSelected
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
onClick() {
|
|
31
|
+
this.$emit('change', !this.active)
|
|
32
|
+
if (this.parent) {
|
|
33
|
+
this.parent.triggerChange(this.value)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
41
36
|
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
<style scoped>
|
|
41
|
+
.dof-tag {
|
|
42
|
+
height: 72px;
|
|
43
|
+
border-radius: 36px;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
.dof-tag--normal {
|
|
49
|
+
background-color: #f2f2f2;
|
|
50
|
+
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
52
|
+
.dof-tag--active {
|
|
53
|
+
background-color: #267aff;
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
.dof-tag-text {
|
|
57
|
+
font-family: PingFangSC-Regular;
|
|
58
|
+
font-size: 28px;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
align-items: center;
|
|
65
|
-
justify-content: center;
|
|
66
|
-
}
|
|
62
|
+
.dof-tag-text--normal {
|
|
63
|
+
color: #666666;
|
|
64
|
+
}
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
line-height: 22px;
|
|
72
|
-
padding-left: 6px;
|
|
73
|
-
padding-right: 6px;
|
|
74
|
-
}
|
|
66
|
+
.dof-tag-text--active {
|
|
67
|
+
color: #ffffff;
|
|
68
|
+
}
|
|
75
69
|
</style>
|
|
76
|
-
|
|
77
|
-
<script>
|
|
78
|
-
export default {
|
|
79
|
-
props: {
|
|
80
|
-
type: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: 'solid'
|
|
83
|
-
},
|
|
84
|
-
value: {
|
|
85
|
-
type: [String, Number],
|
|
86
|
-
default: '测试测试'
|
|
87
|
-
},
|
|
88
|
-
tagColor: {
|
|
89
|
-
type: String,
|
|
90
|
-
default: '#ff5000'
|
|
91
|
-
},
|
|
92
|
-
fontColor: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: '#333333'
|
|
95
|
-
},
|
|
96
|
-
specialIcon: {
|
|
97
|
-
type: String,
|
|
98
|
-
default: ''
|
|
99
|
-
},
|
|
100
|
-
img: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: ''
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
computed: {
|
|
106
|
-
showSolid () {
|
|
107
|
-
const { type, value } = this;
|
|
108
|
-
return type === 'solid' && value !== '';
|
|
109
|
-
},
|
|
110
|
-
showHollow () {
|
|
111
|
-
const { type, value } = this;
|
|
112
|
-
return type === 'hollow' && value !== '';
|
|
113
|
-
},
|
|
114
|
-
showSpecial () {
|
|
115
|
-
const { type, value, specialIcon } = this;
|
|
116
|
-
return type === 'special' && value !== '' && specialIcon !== '';
|
|
117
|
-
},
|
|
118
|
-
showImage () {
|
|
119
|
-
const { type, img } = this;
|
|
120
|
-
return type === 'image' && img !== '';
|
|
121
|
-
},
|
|
122
|
-
tagTextStyle () {
|
|
123
|
-
const { tagColor, showSolid } = this;
|
|
124
|
-
return showSolid ? { backgroundColor: tagColor } : { borderColor: tagColor };
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
data: () => ({
|
|
128
|
-
imgWidth: 90
|
|
129
|
-
}),
|
|
130
|
-
methods: {
|
|
131
|
-
onLoad (e) {
|
|
132
|
-
if (e.success && e.size && e.size.naturalWidth > 0) {
|
|
133
|
-
const width = e.size.naturalWidth;
|
|
134
|
-
const height = e.size.naturalHeight;
|
|
135
|
-
this.imgWidth = width * (24 / height);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './index.vue'
|