sadais-piui 1.2.7-beta20 → 1.2.7-beta23
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.
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
<!-- 注意:slot内不能使用父组件data -->
|
|
3
|
+
<view
|
|
4
|
+
class="dropdown-tab-item pi-justify-center pi-align-center"
|
|
5
|
+
:style="[getTabItemStyle]"
|
|
6
|
+
:class="[{ opened: item.opened }]"
|
|
7
|
+
@tap.stop="handleClick"
|
|
8
|
+
>
|
|
9
|
+
<pi-icon
|
|
10
|
+
v-if="item.showIcon"
|
|
11
|
+
:name="item.iconOption.name"
|
|
12
|
+
:dot="item.iconOption.dot"
|
|
13
|
+
:badge="item.iconOption.badge"
|
|
14
|
+
:color="item.iconOption.color"
|
|
15
|
+
:size="item.iconOption.size"
|
|
16
|
+
:class-prefix="item.iconOption.classPrefix"
|
|
17
|
+
:custom-style="item.iconOption.customStyle"
|
|
18
|
+
:custom-class="`pi-mg-right-8 ${item.iconOption.customClass}`"
|
|
19
|
+
/>
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</view>
|
|
21
|
+
<text class="pi-pd-right-12 pi-fz-28">
|
|
22
|
+
{{ item.text }}
|
|
23
|
+
</text>
|
|
24
|
+
<pi-icon :class="{ rotate: item.opened }" name="arrow-down_fill" size="26" color="#999" />
|
|
26
25
|
</view>
|
|
27
26
|
</template>
|
|
28
27
|
|
|
@@ -39,6 +38,15 @@ export default {
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
},
|
|
41
|
+
computed: {
|
|
42
|
+
getTabItemStyle() {
|
|
43
|
+
const styles = {}
|
|
44
|
+
if (this.item.opened && this.item.activeColor) {
|
|
45
|
+
styles.color = this.item.activeColor
|
|
46
|
+
}
|
|
47
|
+
return styles
|
|
48
|
+
}
|
|
49
|
+
},
|
|
42
50
|
methods: {
|
|
43
51
|
handleClick() {
|
|
44
52
|
this.$emit('click', this.item)
|
|
@@ -49,6 +57,8 @@ export default {
|
|
|
49
57
|
|
|
50
58
|
<style lang="scss" scoped>
|
|
51
59
|
.dropdown-tab-item {
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
52
62
|
&.opened {
|
|
53
63
|
color: $pi-primary-color;
|
|
54
64
|
}
|
|
@@ -498,6 +498,7 @@ export default {
|
|
|
498
498
|
.form-label {
|
|
499
499
|
font-weight: $pi-form-label-weight;
|
|
500
500
|
color: $pi-form-label-color;
|
|
501
|
+
white-space: nowrap;
|
|
501
502
|
&.border {
|
|
502
503
|
@include pi-border;
|
|
503
504
|
&::after {
|
|
@@ -507,6 +508,7 @@ export default {
|
|
|
507
508
|
}
|
|
508
509
|
}
|
|
509
510
|
.content-wrap {
|
|
511
|
+
overflow: hidden;
|
|
510
512
|
&.nowrap {
|
|
511
513
|
margin-left: 24rpx;
|
|
512
514
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="pi-steps pi-of-hidden"
|
|
4
|
+
:style="[customStyle, { flexDirection: direction }]"
|
|
5
|
+
:class="customClass"
|
|
6
|
+
>
|
|
3
7
|
<view
|
|
4
8
|
v-for="(item, index) in getItems"
|
|
5
9
|
:key="index"
|
|
@@ -37,7 +41,13 @@
|
|
|
37
41
|
|
|
38
42
|
<!-- 文字 -->
|
|
39
43
|
<view :class="['pi-steps-item-text']" :style="{ color: item.style.fontColor }">
|
|
40
|
-
<slot
|
|
44
|
+
<slot
|
|
45
|
+
name="item"
|
|
46
|
+
:item="item"
|
|
47
|
+
:index="index"
|
|
48
|
+
:length="getItems.length"
|
|
49
|
+
:active="index < val"
|
|
50
|
+
>
|
|
41
51
|
<view>{{ item.name }}</view>
|
|
42
52
|
<text v-if="item.desc" class="pi-fz-20 pi-mg-top-10" style="word-break:break-all">
|
|
43
53
|
{{ item.desc }}
|
|
@@ -47,7 +57,7 @@
|
|
|
47
57
|
|
|
48
58
|
<!-- 中线 -->
|
|
49
59
|
<view
|
|
50
|
-
v-if="index < items.length - 1"
|
|
60
|
+
v-if="items.length === 1 || index < items.length - 1"
|
|
51
61
|
class="pi-steps-item-line"
|
|
52
62
|
:style="[lineStyle, item.lineStyle]"
|
|
53
63
|
>
|
|
@@ -167,7 +177,7 @@ export default {
|
|
|
167
177
|
},
|
|
168
178
|
lineStyle() {
|
|
169
179
|
const style = {}
|
|
170
|
-
const size = this.getDotMaxSize / 2 + 'rpx'
|
|
180
|
+
const size = this.getDotMaxSize / 2 - 2 + 'rpx'
|
|
171
181
|
this.direction === 'column' ? (style.left = size) : (style.top = size)
|
|
172
182
|
return style
|
|
173
183
|
},
|
|
@@ -240,15 +250,17 @@ export default {
|
|
|
240
250
|
this.direction === 'column' &&
|
|
241
251
|
this.itemsRect.length &&
|
|
242
252
|
this.iconsRect.length &&
|
|
243
|
-
index < this.itemsRect.length - 1
|
|
253
|
+
(this.itemsRect.length === 1 || index < this.itemsRect.length - 1)
|
|
244
254
|
) {
|
|
245
255
|
// 动态计算线的位置和高度
|
|
246
256
|
item.lineStyle.top = `${this.iconsRect[index].top -
|
|
247
257
|
this.itemsRect[index].top +
|
|
248
258
|
this.iconsRect[index].height +
|
|
249
259
|
2}px`
|
|
250
|
-
|
|
251
|
-
this.iconsRect[index + 1].height
|
|
260
|
+
const nextIconsRectHeight = this.iconsRect[index + 1]
|
|
261
|
+
? this.iconsRect[index + 1].height
|
|
262
|
+
: 0
|
|
263
|
+
item.lineStyle.height = `${this.itemsRect[index].height - nextIconsRectHeight}px`
|
|
252
264
|
}
|
|
253
265
|
return item
|
|
254
266
|
})
|
|
@@ -268,6 +280,7 @@ export default {
|
|
|
268
280
|
},
|
|
269
281
|
methods: {
|
|
270
282
|
async init() {
|
|
283
|
+
if (!this.items?.length) return
|
|
271
284
|
this.iconsRect = await this.$pi.common.queryRect(this, '.step-icon-inner', true)
|
|
272
285
|
this.itemsRect = await this.$pi.common.queryRect(this, '.pi-steps-item', true)
|
|
273
286
|
console.log(TAG, '计算.pi-steps布局', this.itemsRect, this.iconsRect)
|