dolphin-weex-ui 2.2.0 → 2.2.1
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 +6 -1
- package/dist/index.native.js +207 -168
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.js +184 -174
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
- package/packages/dof-actionsheet/index.vue +1 -1
- package/packages/dof-bottom-bar/index.vue +1 -1
- package/packages/dof-button/index.vue +90 -12
- package/packages/dof-button/type.js +30 -30
- package/packages/dof-slider-bar/index.vue +483 -460
- package/packages/dof-step-flow-h/index.vue +173 -165
|
@@ -1,209 +1,217 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<div class="step-body">
|
|
3
|
+
<div class="step-item-wrapper" :style="[rowStyles]" ref="wrapper">
|
|
4
|
+
<div class="step-flow-wrapper">
|
|
5
|
+
<template v-for="(item, index) in formattedList">
|
|
6
|
+
<div
|
|
7
|
+
v-if="index < formattedList.length - 1"
|
|
8
|
+
:class="['step-line', showLine && 'hline']"
|
|
9
|
+
:key="'line' + index"
|
|
10
|
+
:style="{ ...item.lineStyles, ...linePos[index] }"
|
|
11
|
+
></div>
|
|
12
|
+
</template>
|
|
13
|
+
</div>
|
|
14
|
+
<div
|
|
15
|
+
v-for="(item, index) in formattedList"
|
|
16
|
+
:key="'desc' + index"
|
|
17
|
+
class="step-item"
|
|
18
|
+
:ref="'item' + index"
|
|
19
|
+
:style="[item.columnStyles]"
|
|
20
|
+
>
|
|
21
|
+
<div :class="['step-point']" :style="[item.pointStyles]" :ref="'point' + index"></div>
|
|
22
|
+
<text :class="['step-desc']" :style="[item.descStyles]">{{ item.desc }}</text>
|
|
23
|
+
</div>
|
|
14
24
|
</div>
|
|
25
|
+
</div>
|
|
15
26
|
</template>
|
|
16
27
|
|
|
17
28
|
<script>
|
|
18
29
|
const domModule = weex.requireModule('dom')
|
|
19
30
|
export default {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
stylesConfig: {
|
|
26
|
-
type: Object,
|
|
27
|
-
default: function () {
|
|
28
|
-
return {
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
showLine:{
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false
|
|
35
|
-
}
|
|
31
|
+
props: {
|
|
32
|
+
list: {
|
|
33
|
+
type: Array,
|
|
34
|
+
default: () => []
|
|
36
35
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
36
|
+
stylesConfig: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: function() {
|
|
39
|
+
return {}
|
|
40
|
+
}
|
|
43
41
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
showLine: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
componentWidth: 750,
|
|
50
|
+
activeIndex: -1,
|
|
51
|
+
linePos: []
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
watch: {
|
|
55
|
+
list(newVal) {
|
|
56
|
+
this.$nextTick(() => {
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
this.init()
|
|
59
|
+
}, 100)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
formattedList() {
|
|
65
|
+
let formattedList = this.formatList(this.list)
|
|
66
|
+
return formattedList
|
|
52
67
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return this.formatList(this.list)
|
|
56
|
-
},
|
|
57
|
-
rowStyles() {
|
|
58
|
-
const {
|
|
59
|
-
rowStyles = {}
|
|
60
|
-
} = this.stylesConfig
|
|
68
|
+
rowStyles() {
|
|
69
|
+
const { rowStyles = {} } = this.stylesConfig
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
//处理行
|
|
72
|
+
return { ...rowStyles }
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
init() {
|
|
77
|
+
this.list.forEach(item => {
|
|
78
|
+
this.linePos.push({ width: 0 })
|
|
79
|
+
})
|
|
80
|
+
// 确定第一条线的左边距离
|
|
81
|
+
if (this.linePos.length > 0) {
|
|
82
|
+
domModule.getComponentRect(this.$refs['item0'][0], data => {
|
|
83
|
+
this.linePos[0]['margin-left'] = data.size.width / 2 + 8 + 'px'
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
this.list.forEach((item, index, arr) => {
|
|
87
|
+
// 确定条线的宽度
|
|
88
|
+
domModule.getComponentRect(this.$refs['point' + index][0], data => {
|
|
89
|
+
if (index == 0) {
|
|
90
|
+
this.linePos[index]['data-right'] = data.size.right
|
|
91
|
+
} else {
|
|
92
|
+
this.linePos[index]['data-right'] = data.size.right
|
|
93
|
+
this.linePos[index - 1]['width'] = data.size.left - this.linePos[index - 1]['data-right'] + 'px'
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
})
|
|
65
97
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
this.list.forEach((item, index, arr) => {
|
|
78
|
-
// 确定条线的宽度
|
|
79
|
-
domModule.getComponentRect(this.$refs['point' + index][0], (data) => {
|
|
80
|
-
if (index == 0) {
|
|
81
|
-
this.linePos[index]['data-right'] = data.size.right
|
|
82
|
-
} else {
|
|
83
|
-
this.linePos[index]['data-right'] = data.size.right
|
|
84
|
-
this.linePos[index - 1]['width'] = data.size.left - this.linePos[index - 1]['data-right']
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
},
|
|
89
|
-
formatList(list) {
|
|
90
|
-
let tempList = JSON.parse(JSON.stringify(list))
|
|
91
|
-
const {
|
|
92
|
-
activedColor = '#00de51',
|
|
93
|
-
pointStyles = {},
|
|
94
|
-
lineStyles = {},
|
|
95
|
-
descStyles = {},
|
|
96
|
-
columnStyles = {}
|
|
97
|
-
} = this.stylesConfig
|
|
98
|
+
formatList(list) {
|
|
99
|
+
let tempList = JSON.parse(JSON.stringify(list))
|
|
100
|
+
const {
|
|
101
|
+
activedColor = '#00de51',
|
|
102
|
+
pointStyles = {},
|
|
103
|
+
lineStyles = {},
|
|
104
|
+
descStyles = {},
|
|
105
|
+
columnStyles = {}
|
|
106
|
+
} = this.stylesConfig
|
|
98
107
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
tempList.forEach((item, index) => {
|
|
109
|
+
if (item.isActived) this.activeIndex = index
|
|
110
|
+
})
|
|
102
111
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
let result = []
|
|
113
|
+
result = tempList.map((item, index) => {
|
|
114
|
+
//处理列
|
|
115
|
+
item['columnStyles'] = { ...item['columnStyles'], ...columnStyles }
|
|
107
116
|
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
//处理节点point
|
|
118
|
+
item['pointStyles'] = { ...item['pointStyles'], ...pointStyles }
|
|
110
119
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
if (index <= this.activeIndex) {
|
|
121
|
+
item['pointStyles']['background-color'] = activedColor
|
|
122
|
+
item['pointStyles']['opacity'] = 1
|
|
123
|
+
}
|
|
115
124
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
//处理节点线条
|
|
126
|
+
item['lineStyles'] = { ...item['lineStyles'], ...lineStyles }
|
|
127
|
+
if (index < this.activeIndex) {
|
|
128
|
+
item['lineStyles']['border-top-color'] = activedColor
|
|
129
|
+
item['lineStyles']['opacity'] = 1
|
|
130
|
+
}
|
|
122
131
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
//处理内容
|
|
133
|
+
item['descStyles'] = { ...item['descStyles'], ...descStyles }
|
|
134
|
+
if (item.isActived && activedColor) {
|
|
135
|
+
item['descStyles']['color'] = activedColor
|
|
136
|
+
item['descStyles']['opacity'] = 1
|
|
137
|
+
}
|
|
129
138
|
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
return item
|
|
140
|
+
})
|
|
132
141
|
|
|
133
|
-
|
|
134
|
-
return result
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
mounted() {
|
|
138
|
-
this.$nextTick(() => {
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
this.init()
|
|
141
|
-
}, 100);
|
|
142
|
-
})
|
|
142
|
+
return result
|
|
143
143
|
}
|
|
144
|
+
},
|
|
145
|
+
mounted() {
|
|
146
|
+
this.$nextTick(() => {
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
this.init()
|
|
149
|
+
}, 100)
|
|
150
|
+
})
|
|
151
|
+
}
|
|
144
152
|
}
|
|
145
153
|
</script>
|
|
146
154
|
|
|
147
155
|
<style scoped>
|
|
148
156
|
.step-body {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
align-items: stretch;
|
|
160
|
+
overflow: hidden;
|
|
153
161
|
}
|
|
154
162
|
.step-flow-wrapper {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
position: absolute;
|
|
164
|
+
left: 0;
|
|
165
|
+
right: 0;
|
|
166
|
+
top: 0;
|
|
167
|
+
height: 16px;
|
|
168
|
+
flex-direction: row;
|
|
169
|
+
justify-content: flex-start;
|
|
170
|
+
align-items: center;
|
|
171
|
+
overflow: hidden;
|
|
164
172
|
}
|
|
165
173
|
.step-line {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
width: 0px;
|
|
175
|
+
height: 2px;
|
|
176
|
+
border-top-color: #e5e5e8;
|
|
177
|
+
border-top-width: 2px;
|
|
178
|
+
border-top-style: solid;
|
|
179
|
+
margin-left: 8px;
|
|
180
|
+
margin-right: 8px;
|
|
173
181
|
}
|
|
174
182
|
|
|
175
|
-
.hline{
|
|
176
|
-
|
|
183
|
+
.hline {
|
|
184
|
+
border-top-width: 4px;
|
|
177
185
|
}
|
|
178
186
|
.step-item-wrapper {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
flex-direction: row;
|
|
188
|
+
justify-content: space-between;
|
|
189
|
+
align-items: flex-start;
|
|
182
190
|
}
|
|
183
191
|
.step-item {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
flex-direction: column;
|
|
193
|
+
justify-content: flex-start;
|
|
194
|
+
align-items: center;
|
|
195
|
+
overflow: hidden;
|
|
196
|
+
word-wrap: break-word;
|
|
197
|
+
word-break: break-all;
|
|
198
|
+
padding-left: 8px;
|
|
199
|
+
padding-right: 8px;
|
|
192
200
|
}
|
|
193
201
|
.step-point {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
202
|
+
width: 16px;
|
|
203
|
+
height: 16px;
|
|
204
|
+
background-color: #c7c7cc;
|
|
205
|
+
border-radius: 32px;
|
|
198
206
|
}
|
|
199
207
|
.step-desc {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
padding-top: 20px;
|
|
209
|
+
font-family: PingFangSC-Regular;
|
|
210
|
+
font-size: 26px;
|
|
211
|
+
color: #8a8a8f;
|
|
212
|
+
text-align: center;
|
|
205
213
|
}
|
|
206
214
|
.active-step {
|
|
207
|
-
|
|
215
|
+
color: #000000;
|
|
208
216
|
}
|
|
209
217
|
</style>
|