mali-applet-ui 1.1.65 → 1.1.67
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,20 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="ml-progress-bar" :class="className">
|
|
3
|
-
<view class="progress-bar-header">
|
|
3
|
+
<view v-if="showHeader || title" class="progress-bar-header">
|
|
4
4
|
<slot name="header">
|
|
5
5
|
<view v-if="title" class="progress-header-title" :class="{'is-underline': titleUnderline}">{{ title }}</view>
|
|
6
|
-
<view v-if="
|
|
6
|
+
<view v-if="showTitleNum" class="progress-header-num">{{ titleNum || (`${percNum}${unit || ''}`) }}</view>
|
|
7
7
|
</slot>
|
|
8
8
|
</view>
|
|
9
|
-
<view class="progress-bar-chart"
|
|
10
|
-
<progress
|
|
9
|
+
<view class="progress-bar-chart" @click="barClick">
|
|
10
|
+
<view v-if="showBarTitle" class="progress-bar-left" :style="barLeftStyle">
|
|
11
|
+
<slot name="bar_title">
|
|
12
|
+
<text>{{ barTitle || '' }}</text>
|
|
13
|
+
</slot>
|
|
14
|
+
</view>
|
|
15
|
+
<view class="progress-bar-content">
|
|
16
|
+
<progress
|
|
11
17
|
:percent="percNum"
|
|
12
18
|
:activeColor="activeColor || '#1890FF'"
|
|
13
19
|
:backgroundColor="backgroundColor"
|
|
14
20
|
:strokeWidth="strokeWidth"
|
|
15
21
|
:fontSize="fontSize"
|
|
16
22
|
:border-radius="borderRadius" />
|
|
17
|
-
|
|
23
|
+
<view v-if="showBarRatio" class="progress-bar-ratio">{{ barRatio || `${value}/${max}` }}</view>
|
|
24
|
+
</view>
|
|
25
|
+
<view v-if="showBarNum" class="progress-bar-right">
|
|
26
|
+
<slot name="bar_num">
|
|
27
|
+
<text>{{ barNum || (`${percNum}${unit || ''}`) }}</text>
|
|
28
|
+
</slot>
|
|
29
|
+
</view>
|
|
18
30
|
</view>
|
|
19
31
|
<view class="progress-bar-footer">
|
|
20
32
|
<slot name="footer"></slot>
|
|
@@ -38,9 +50,13 @@ export default {
|
|
|
38
50
|
},
|
|
39
51
|
title: String,
|
|
40
52
|
titleUnderline: Boolean,
|
|
53
|
+
showHeader: Boolean,
|
|
54
|
+
showBarTitle: Boolean,
|
|
55
|
+
barTitle: String,
|
|
56
|
+
barTitleWidth: [Number, String],
|
|
41
57
|
strokeWidth: {
|
|
42
58
|
type: [Number, String],
|
|
43
|
-
default:
|
|
59
|
+
default: 16
|
|
44
60
|
},
|
|
45
61
|
activeColor: String,
|
|
46
62
|
fontSize: {
|
|
@@ -52,11 +68,23 @@ export default {
|
|
|
52
68
|
default: '4rpx'
|
|
53
69
|
},
|
|
54
70
|
backgroundColor: String,
|
|
55
|
-
|
|
71
|
+
showTitleNum: Boolean,
|
|
72
|
+
titleNum: [Number, String],
|
|
73
|
+
showBarNum: Boolean,
|
|
74
|
+
barNum: Boolean,
|
|
75
|
+
showBarRatio: Boolean,
|
|
76
|
+
barRatio: Boolean,
|
|
56
77
|
unit: String,
|
|
57
78
|
className: String
|
|
58
79
|
},
|
|
59
80
|
computed: {
|
|
81
|
+
barLeftStyle () {
|
|
82
|
+
let stys = ''
|
|
83
|
+
if (this.barTitleWidth) {
|
|
84
|
+
stys = `width: ${XEUtils.isString(this.barTitleWidth) ? this.barTitleWidth : `${this.barTitleWidth}rpx`}`
|
|
85
|
+
}
|
|
86
|
+
return stys
|
|
87
|
+
},
|
|
60
88
|
percNum () {
|
|
61
89
|
return Math.ceil(XEUtils.toNumber(this.value) / (Math.max(1, XEUtils.toNumber(this.max)) / 100))
|
|
62
90
|
},
|
|
@@ -81,19 +109,38 @@ export default {
|
|
|
81
109
|
text-align: left;
|
|
82
110
|
}
|
|
83
111
|
.progress-bar-chart {
|
|
84
|
-
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: row;
|
|
85
114
|
position: relative;
|
|
86
115
|
margin: 12rpx 0;
|
|
87
|
-
|
|
88
|
-
|
|
116
|
+
.progress-bar-left,
|
|
117
|
+
.progress-bar-right {
|
|
118
|
+
flex-shrink: 0;
|
|
119
|
+
font-size: 24rpx;
|
|
120
|
+
line-height: 28rpx;
|
|
121
|
+
padding: 0 4rpx;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
text-overflow: ellipsis;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
.progress-bar-left {
|
|
127
|
+
width: 80rpx;
|
|
89
128
|
}
|
|
90
|
-
.progress-bar-
|
|
129
|
+
.progress-bar-right {
|
|
130
|
+
width: 120rpx;
|
|
131
|
+
}
|
|
132
|
+
.progress-bar-content {
|
|
133
|
+
flex-grow: 1;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
position: relative;
|
|
136
|
+
}
|
|
137
|
+
.progress-bar-ratio {
|
|
91
138
|
position: absolute;
|
|
92
|
-
right: 0;
|
|
93
139
|
top: 0;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
140
|
+
left: 4rpx;
|
|
141
|
+
font-size: 24rpx;
|
|
142
|
+
line-height: 28rpx;
|
|
143
|
+
color: #fff;
|
|
97
144
|
}
|
|
98
145
|
}
|
|
99
146
|
.progress-header-title {
|
|
@@ -107,9 +154,7 @@ export default {
|
|
|
107
154
|
}
|
|
108
155
|
}
|
|
109
156
|
.progress-header-num {
|
|
110
|
-
flex-
|
|
111
|
-
min-width: 60rpx;
|
|
112
|
-
text-align: right;
|
|
157
|
+
flex-shrink: 0;
|
|
113
158
|
}
|
|
114
159
|
}
|
|
115
160
|
</style>
|