mali-applet-ui 0.0.7 → 0.0.8
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.
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-progress-bar">
|
|
3
|
+
<view class="progress-bar-header">
|
|
4
|
+
<slot name="header">
|
|
5
|
+
<view v-if="title !== null" class="progress-bar-title" :class="{underline: titleUnderline}">{{ title }}</view>
|
|
6
|
+
</slot>
|
|
7
|
+
</view>
|
|
8
|
+
<view class="progress-bar-chart" @click="barClick">
|
|
9
|
+
<progress
|
|
10
|
+
:percent="percNum"
|
|
11
|
+
:activeColor="activeColor || '#1890FF'"
|
|
12
|
+
:backgroundColor="backgroundColor"
|
|
13
|
+
:strokeWidth="strokeWidth"
|
|
14
|
+
:fontSize="fontSize"
|
|
15
|
+
:border-radius="borderRadius" />
|
|
16
|
+
<view v-if="showNum" class="progress-bar-num">{{ value || 0 }}{{ unit || '' }}</view>
|
|
17
|
+
</view>
|
|
18
|
+
<view class="progress-bar-footer">
|
|
19
|
+
<slot name="footer"></slot>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import XEUtils from 'xe-utils'
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
name: 'ml-progress-bar',
|
|
29
|
+
props: {
|
|
30
|
+
value: Number,
|
|
31
|
+
max: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 100
|
|
34
|
+
},
|
|
35
|
+
title: String,
|
|
36
|
+
titleUnderline: Boolean,
|
|
37
|
+
strokeWidth: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: 12
|
|
40
|
+
},
|
|
41
|
+
activeColor: String,
|
|
42
|
+
fontSize: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '24rpx'
|
|
45
|
+
},
|
|
46
|
+
borderRadius: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: '4rpx'
|
|
49
|
+
},
|
|
50
|
+
backgroundColor: String,
|
|
51
|
+
showNum: Boolean,
|
|
52
|
+
unit: String
|
|
53
|
+
},
|
|
54
|
+
computed: {
|
|
55
|
+
percNum () {
|
|
56
|
+
return Math.ceil(XEUtils.toNumber(this.value) / (XEUtils.toNumber(this.max) / 100))
|
|
57
|
+
},
|
|
58
|
+
barOpts () {
|
|
59
|
+
return Object.assign({}, this.barStyle)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
barClick () {
|
|
64
|
+
this.$emit('bar-click')
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style lang="scss">
|
|
71
|
+
.ml-progress-bar {
|
|
72
|
+
.progress-bar-header {
|
|
73
|
+
text-align: left;
|
|
74
|
+
}
|
|
75
|
+
.progress-bar-chart {
|
|
76
|
+
height: 24rpx;
|
|
77
|
+
position: relative;
|
|
78
|
+
margin: 12rpx 0;
|
|
79
|
+
padding-right: 46rpx;
|
|
80
|
+
.progress-bar-num {
|
|
81
|
+
position: absolute;
|
|
82
|
+
right: 0;
|
|
83
|
+
top: 0;
|
|
84
|
+
line-height: 24rpx;
|
|
85
|
+
width: 38rpx;
|
|
86
|
+
text-align: left;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
.progress-bar-title {
|
|
90
|
+
color: rgba(0, 0, 0, 0.85);
|
|
91
|
+
font-size: 24rpx;
|
|
92
|
+
&.underline {
|
|
93
|
+
text-decoration: underline;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<text v-if="value !== null">{{ selectName }}</text>
|
|
6
6
|
<text v-else class="picker-placeholder">{{ placeholder }}</text>
|
|
7
7
|
</view>
|
|
8
|
-
<ml-icon class="picker-icon" name="arrow-down"
|
|
8
|
+
<ml-icon class="picker-icon" name="arrow-down" />
|
|
9
9
|
</view>
|
|
10
10
|
</picker>
|
|
11
11
|
</template>
|