stellar-ui-v2 1.35.3
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/common/css/common.scss +61 -0
- package/components/ste-animate/README.md +117 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/ste-animate.vue +200 -0
- package/components/ste-badge/README.md +171 -0
- package/components/ste-badge/ste-badge.vue +238 -0
- package/components/ste-barcode/README.md +36 -0
- package/components/ste-barcode/encode2.js +317 -0
- package/components/ste-barcode/ste-barcode.vue +213 -0
- package/components/ste-button/README.md +129 -0
- package/components/ste-button/ste-button.vue +345 -0
- package/components/ste-calendar/README.md +304 -0
- package/components/ste-calendar/self-date.js +119 -0
- package/components/ste-calendar/ste-calendar.vue +578 -0
- package/components/ste-checkbox/README.md +297 -0
- package/components/ste-checkbox/ste-checkbox.vue +305 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +133 -0
- package/components/ste-code-input/README.md +67 -0
- package/components/ste-code-input/ste-code-input.vue +302 -0
- package/components/ste-date-picker/README.md +135 -0
- package/components/ste-date-picker/ste-date-picker.vue +407 -0
- package/components/ste-drag/README.md +103 -0
- package/components/ste-drag/ste-drag.vue +203 -0
- package/components/ste-dropdown-menu/README.md +358 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -0
- package/components/ste-icon/README.md +90 -0
- package/components/ste-icon/iconfont.css +8 -0
- package/components/ste-icon/ste-icon.vue +147 -0
- package/components/ste-image/README.md +154 -0
- package/components/ste-image/ste-image.vue +218 -0
- package/components/ste-index-item/ste-index-item.vue +96 -0
- package/components/ste-index-list/README.md +153 -0
- package/components/ste-index-list/ste-index-list.vue +128 -0
- package/components/ste-input/README.md +146 -0
- package/components/ste-input/ste-input.vue +480 -0
- package/components/ste-loading/README.md +81 -0
- package/components/ste-loading/ste-loading.vue +166 -0
- package/components/ste-media-preview/README.md +243 -0
- package/components/ste-media-preview/TouchScaleing.js +102 -0
- package/components/ste-media-preview/ste-media-preview.vue +267 -0
- package/components/ste-message-box/README.md +217 -0
- package/components/ste-message-box/ste-message-box.js +72 -0
- package/components/ste-message-box/ste-message-box.vue +380 -0
- package/components/ste-notice-bar/README.md +129 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +331 -0
- package/components/ste-number-keyboard/README.md +246 -0
- package/components/ste-number-keyboard/keyboard.vue +140 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +240 -0
- package/components/ste-picker/ste-picker.vue +258 -0
- package/components/ste-popup/README.md +148 -0
- package/components/ste-popup/ste-popup.vue +337 -0
- package/components/ste-price/README.md +129 -0
- package/components/ste-price/ste-price.vue +258 -0
- package/components/ste-progress/README.md +87 -0
- package/components/ste-progress/ste-progress.vue +200 -0
- package/components/ste-qrcode/README.md +50 -0
- package/components/ste-qrcode/ste-qrcode.vue +164 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/README.md +286 -0
- package/components/ste-radio/ste-radio.vue +293 -0
- package/components/ste-radio-group/ste-radio-group.vue +128 -0
- package/components/ste-rate/README.md +115 -0
- package/components/ste-rate/ste-rate.vue +202 -0
- package/components/ste-read-more/README.md +111 -0
- package/components/ste-read-more/ste-read-more.vue +133 -0
- package/components/ste-rich-text/README.md +31 -0
- package/components/ste-rich-text/ste-rich-text.vue +70 -0
- package/components/ste-scroll-to/README.md +68 -0
- package/components/ste-scroll-to/mixin.js +173 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +45 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +25 -0
- package/components/ste-search/README.md +262 -0
- package/components/ste-search/ste-search.vue +547 -0
- package/components/ste-select/README.md +434 -0
- package/components/ste-select/datapager.vue +62 -0
- package/components/ste-select/datetime.vue +106 -0
- package/components/ste-select/defaultDate.js +142 -0
- package/components/ste-select/ste-select.vue +843 -0
- package/components/ste-signature/README.md +105 -0
- package/components/ste-signature/ste-signature.vue +220 -0
- package/components/ste-slider/README.md +165 -0
- package/components/ste-slider/ste-slider.vue +544 -0
- package/components/ste-step/ste-step.vue +264 -0
- package/components/ste-stepper/README.md +170 -0
- package/components/ste-stepper/ste-stepper.vue +373 -0
- package/components/ste-steps/README.md +132 -0
- package/components/ste-steps/ste-steps.vue +65 -0
- package/components/ste-sticky/README.md +52 -0
- package/components/ste-sticky/ste-sticky.vue +127 -0
- package/components/ste-swipe-action/README.md +197 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +303 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -0
- package/components/ste-swiper/README.md +173 -0
- package/components/ste-swiper/ste-swiper.vue +462 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/README.md +110 -0
- package/components/ste-switch/ste-switch.vue +144 -0
- package/components/ste-tab/ste-tab.vue +87 -0
- package/components/ste-table/README.md +785 -0
- package/components/ste-table/common.js +8 -0
- package/components/ste-table/ste-table.vue +666 -0
- package/components/ste-table/utils.js +20 -0
- package/components/ste-table-column/checkbox-icon.vue +65 -0
- package/components/ste-table-column/common.scss +65 -0
- package/components/ste-table-column/radio-icon.vue +110 -0
- package/components/ste-table-column/ste-table-column.vue +255 -0
- package/components/ste-table-column/sub-table.vue +116 -0
- package/components/ste-table-column/table-popover.vue +204 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/README.md +475 -0
- package/components/ste-tabs/props.js +212 -0
- package/components/ste-tabs/ste-tabs.vue +758 -0
- package/components/ste-text/README.md +66 -0
- package/components/ste-text/ste-text.vue +72 -0
- package/components/ste-toast/README.md +243 -0
- package/components/ste-toast/ste-toast.js +69 -0
- package/components/ste-toast/ste-toast.vue +231 -0
- package/components/ste-touch-swipe/README.md +104 -0
- package/components/ste-touch-swipe/TouchEvent.js +72 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -0
- package/components/ste-tour/README.md +194 -0
- package/components/ste-tour/ste-tour.vue +355 -0
- package/components/ste-tree/README.md +240 -0
- package/components/ste-tree/ste-tree.vue +350 -0
- package/components/ste-upload/README.md +276 -0
- package/components/ste-upload/ReadFile.js +229 -0
- package/components/ste-upload/ste-upload.vue +526 -0
- package/components/ste-video/README.md +60 -0
- package/components/ste-video/props.js +149 -0
- package/components/ste-video/ste-video.vue +647 -0
- package/config/color.js +22 -0
- package/index.js +2 -0
- package/package.json +19 -0
- package/utils/Color.js +66 -0
- package/utils/System.js +110 -0
- package/utils/dayjs.min.js +1 -0
- package/utils/mixin.js +67 -0
- package/utils/store.js +7 -0
- package/utils/utils.js +604 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-price-root">
|
|
3
|
+
<view class="content" :style="[cmpPriceStyle]">
|
|
4
|
+
<text v-if="showUnit" class="unit" :style="[cmpUnitStyle]">{{ unitSymbol }}</text>
|
|
5
|
+
<text class="yuan-price" :style="[cmpYuanPriceStyle]">{{ cmpYuanValue }}</text>
|
|
6
|
+
<text v-if="valueUnit === 'fen'" class="fen-price" :style="[cmpFenPriceStyle]">
|
|
7
|
+
{{ cmpFenValue }}
|
|
8
|
+
</text>
|
|
9
|
+
</view>
|
|
10
|
+
</view>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import utils from '../../utils/utils.js';
|
|
15
|
+
/**
|
|
16
|
+
* ste-price 价格
|
|
17
|
+
* @description 金额组件
|
|
18
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-price
|
|
19
|
+
* @property {Number|String} value 金额 默认值 0
|
|
20
|
+
* @property {String} valueUnit 金额单位
|
|
21
|
+
* @value fen 分(默认值){String}
|
|
22
|
+
* @value yuan 元{String}
|
|
23
|
+
* @property {Boolean} showUnit 是否显示符号
|
|
24
|
+
* @property {String} unitSymbol 符号标记,默认值 ¥
|
|
25
|
+
* @property {Number} digits 精度 默认值 -1
|
|
26
|
+
* @value -1 不处理(默认值){Number}
|
|
27
|
+
* @value 0 取整(四舍五入){Number}
|
|
28
|
+
* @value 1 保留1位小数(四舍五入){Number}
|
|
29
|
+
* @value 2 保留2位小数(四舍五入){Number}
|
|
30
|
+
* @property {Number|String} fontSize 金额文字尺寸 默认值 30
|
|
31
|
+
* @property {String} color 文字颜色 默认值 #ff1e19
|
|
32
|
+
* @property {String} linePriceColor 划线价文字颜色 默认值 #999999
|
|
33
|
+
* @property {Number|String} lineHeight 行高,Number,单位rpx,String,同原生 默认值 1
|
|
34
|
+
* @property {Boolean} isSuggestPrice 是否划线价 默认值 false
|
|
35
|
+
* @property {Number|String} marginLeft 左边距 默认值 0
|
|
36
|
+
* @property {Number|String} marginRight 右边距 默认值 0
|
|
37
|
+
* @property {Number|String} marginTop 上边距 默认值 0
|
|
38
|
+
* @property {Number|String} marginBottom 下边距 默认值 0
|
|
39
|
+
* @property {Number} styleType 金额样式 默认值 2
|
|
40
|
+
* @property {Boolean} bold 是否加粗 默认值 false
|
|
41
|
+
* @property {Function(value)} formatter 用来格式化内容
|
|
42
|
+
*/
|
|
43
|
+
export default {
|
|
44
|
+
group: '电商组件',
|
|
45
|
+
title: 'Price 价格',
|
|
46
|
+
name: 'ste-price',
|
|
47
|
+
props: {
|
|
48
|
+
// 金额
|
|
49
|
+
value: {
|
|
50
|
+
type: [Number, String, null],
|
|
51
|
+
default: 0,
|
|
52
|
+
},
|
|
53
|
+
// 金额单位,fen | yuan,当为fen(分)时,值除以100
|
|
54
|
+
valueUnit: {
|
|
55
|
+
type: [String, null],
|
|
56
|
+
default: 'fen',
|
|
57
|
+
},
|
|
58
|
+
// 精度 -1 不使用精度 0 保留0位小数 1 保留1位小数 2保留2位小数
|
|
59
|
+
digits: {
|
|
60
|
+
type: [Number, null],
|
|
61
|
+
default: -1,
|
|
62
|
+
},
|
|
63
|
+
// 是否显示单位符号
|
|
64
|
+
showUnit: {
|
|
65
|
+
type: [Boolean, null],
|
|
66
|
+
default: true,
|
|
67
|
+
},
|
|
68
|
+
// 单位符号
|
|
69
|
+
unitSymbol: {
|
|
70
|
+
type: [String, null],
|
|
71
|
+
default: '¥',
|
|
72
|
+
},
|
|
73
|
+
// 金额文字尺寸
|
|
74
|
+
fontSize: {
|
|
75
|
+
type: [Number, String, null],
|
|
76
|
+
default: 30,
|
|
77
|
+
},
|
|
78
|
+
// 金额文字颜
|
|
79
|
+
color: {
|
|
80
|
+
type: [String, null, null],
|
|
81
|
+
default: '#FF1E19',
|
|
82
|
+
},
|
|
83
|
+
// 划线价颜色
|
|
84
|
+
linePriceColor: {
|
|
85
|
+
type: [String, null, null],
|
|
86
|
+
default: '#999999',
|
|
87
|
+
},
|
|
88
|
+
// 行高,默认值为-1,当为-1是,line-height:1
|
|
89
|
+
lineHeight: {
|
|
90
|
+
type: [Number, String, null],
|
|
91
|
+
default: -1,
|
|
92
|
+
},
|
|
93
|
+
// 是否是划线价
|
|
94
|
+
isSuggestPrice: {
|
|
95
|
+
type: [Boolean, null],
|
|
96
|
+
default: false,
|
|
97
|
+
},
|
|
98
|
+
// 左margin
|
|
99
|
+
marginLeft: {
|
|
100
|
+
type: [Number, String, null],
|
|
101
|
+
default: 0,
|
|
102
|
+
}, // 右margin
|
|
103
|
+
marginRight: {
|
|
104
|
+
type: [Number, String, null],
|
|
105
|
+
default: 0,
|
|
106
|
+
},
|
|
107
|
+
// 上margin
|
|
108
|
+
marginTop: {
|
|
109
|
+
type: [Number, String, null],
|
|
110
|
+
default: 0,
|
|
111
|
+
}, // 下margin
|
|
112
|
+
marginBottom: {
|
|
113
|
+
type: [Number, String, null],
|
|
114
|
+
default: 0,
|
|
115
|
+
},
|
|
116
|
+
// 金额样式 1 元和角分大小相等(特殊价格) 2 角分小于元(常规价格)3 价格符号和角,分相等
|
|
117
|
+
styleType: {
|
|
118
|
+
type: [Number, null],
|
|
119
|
+
default: 2,
|
|
120
|
+
},
|
|
121
|
+
bold: {
|
|
122
|
+
type: [Boolean, null],
|
|
123
|
+
default: false,
|
|
124
|
+
},
|
|
125
|
+
// 过滤器
|
|
126
|
+
formatter: {
|
|
127
|
+
type: [Function, null],
|
|
128
|
+
default: undefined,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
data() {
|
|
132
|
+
return {};
|
|
133
|
+
},
|
|
134
|
+
computed: {
|
|
135
|
+
cmpValue() {
|
|
136
|
+
if (this.formatter && typeof this.formatter === 'function') {
|
|
137
|
+
return this.formatter(this.value);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
let value = this.value;
|
|
141
|
+
if (this.valueUnit == 'fen') {
|
|
142
|
+
value = utils.fenToYuan(this.value, -1, '', 0);
|
|
143
|
+
}
|
|
144
|
+
if (this.digits == -1) {
|
|
145
|
+
value = Number.parseFloat(Number(value)).toString();
|
|
146
|
+
} else {
|
|
147
|
+
value = Number(value).toFixed(this.digits).toString();
|
|
148
|
+
}
|
|
149
|
+
return value;
|
|
150
|
+
},
|
|
151
|
+
cmpYuanValue() {
|
|
152
|
+
if (this.cmpValue) {
|
|
153
|
+
if (this.cmpValue.indexOf('.') > -1) {
|
|
154
|
+
return this.cmpValue.split('.')[0];
|
|
155
|
+
} else {
|
|
156
|
+
return this.cmpValue;
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
return utils.fenToYuan(this.value, -1, '', 1);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
cmpFenValue() {
|
|
163
|
+
if (this.cmpValue) {
|
|
164
|
+
if (this.cmpValue.indexOf('.') > -1) {
|
|
165
|
+
return '.' + this.cmpValue.split('.')[1];
|
|
166
|
+
}
|
|
167
|
+
return '';
|
|
168
|
+
} else {
|
|
169
|
+
return utils.fenToYuan(this.value, -1, '', 2);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
cmpPriceStyle() {
|
|
173
|
+
return {
|
|
174
|
+
lineHeight: this.lineHeight === -1 ? 0.8 : utils.formatPx(this.lineHeight),
|
|
175
|
+
color: (this.isSuggestPrice ? this.linePriceColor : this.color) + ' !important',
|
|
176
|
+
marginLeft: utils.formatPx(this.marginLeft),
|
|
177
|
+
marginRight: utils.formatPx(this.marginRight),
|
|
178
|
+
marginTop: utils.formatPx(this.marginTop),
|
|
179
|
+
marginBottom: utils.formatPx(this.marginBottom),
|
|
180
|
+
fontWeight: this.bold ? 'bold' : 'normal',
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
cmpUnitStyle() {
|
|
184
|
+
let style = {
|
|
185
|
+
textDecoration: this.isSuggestPrice ? 'line-through' : 'none',
|
|
186
|
+
color: (this.isSuggestPrice ? this.linePriceColor : this.color) + ' !important',
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
if (this.isSuggestPrice) {
|
|
190
|
+
style.color = this.linePriceColor;
|
|
191
|
+
style.fontSize = utils.formatPx(this.fontSize);
|
|
192
|
+
} else {
|
|
193
|
+
style.fontSize = this.calcFontSize();
|
|
194
|
+
}
|
|
195
|
+
return style;
|
|
196
|
+
},
|
|
197
|
+
cmpYuanPriceStyle() {
|
|
198
|
+
return {
|
|
199
|
+
fontSize: utils.formatPx(this.fontSize),
|
|
200
|
+
textDecoration: this.isSuggestPrice ? 'line-through' : 'none',
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
cmpFenPriceStyle() {
|
|
204
|
+
let fontSize = 0;
|
|
205
|
+
if (this.isSuggestPrice) {
|
|
206
|
+
fontSize = utils.formatPx(this.fontSize);
|
|
207
|
+
} else {
|
|
208
|
+
if (this.styleType == 2) {
|
|
209
|
+
fontSize = this.calcFontSize();
|
|
210
|
+
} else {
|
|
211
|
+
fontSize = utils.formatPx(this.fontSize);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
fontSize,
|
|
216
|
+
textDecoration: this.isSuggestPrice ? 'line-through' : 'none',
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
methods: {
|
|
221
|
+
calcFontSize() {
|
|
222
|
+
let size = utils.formatPx(this.fontSize);
|
|
223
|
+
if (this.styleType == 1) {
|
|
224
|
+
if (this.fontSize <= 40) {
|
|
225
|
+
size = utils.formatPx(20);
|
|
226
|
+
} else {
|
|
227
|
+
size = utils.formatPx(this.fontSize - 20);
|
|
228
|
+
}
|
|
229
|
+
} else if (this.styleType == 3) {
|
|
230
|
+
size = utils.formatPx(this.fontSize);
|
|
231
|
+
} else {
|
|
232
|
+
// 常规 - 分元不一致
|
|
233
|
+
if (this.fontSize > 28 && this.fontSize <= 40) {
|
|
234
|
+
size = utils.formatPx(20);
|
|
235
|
+
} else if (this.fontSize > 40) {
|
|
236
|
+
size = utils.formatPx(this.fontSize - 20);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return size;
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<style lang="scss" scoped>
|
|
246
|
+
.ste-price-root {
|
|
247
|
+
display: inline-flex;
|
|
248
|
+
.content {
|
|
249
|
+
display: inline-block;
|
|
250
|
+
vertical-align: bottom;
|
|
251
|
+
}
|
|
252
|
+
.unit {
|
|
253
|
+
vertical-align: baseline;
|
|
254
|
+
}
|
|
255
|
+
.yuan-price {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
</style>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Progress 进度条
|
|
2
|
+
进度条组件
|
|
3
|
+
|
|
4
|
+
---$
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### 代码演示
|
|
8
|
+
#### 背景色
|
|
9
|
+
- 背景色支持纯色、渐变色、图片
|
|
10
|
+
- 支持设置激活部分的背景(`activeBg`)和未激活部分(`inactiveBg`)的背景
|
|
11
|
+
```html
|
|
12
|
+
<ste-progress :percentage="40"></ste-progress>
|
|
13
|
+
<ste-progress :percentage="45" activeBg="https://image.whzb.com/chain/StellarUI/image/p-red.png" inactiveBg="#CCCCCC"></ste-progress>
|
|
14
|
+
<ste-progress :percentage="50"activeBg="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))"></ste-progress>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
#### 线条粗细
|
|
18
|
+
- 通过`strokeWidth`设置线条的粗细
|
|
19
|
+
```html
|
|
20
|
+
<ste-progress :percentage="40" strokeWidth="20"></ste-progress>
|
|
21
|
+
<ste-progress :percentage="45" strokeWidth="36"></ste-progress>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### 禁用
|
|
25
|
+
```html
|
|
26
|
+
<ste-progress :percentage="40" disabled></ste-progress>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### 长度
|
|
30
|
+
- 通过`width`设置进度条长度
|
|
31
|
+
- 默认是`100%`,跟随父容器的宽度
|
|
32
|
+
```html
|
|
33
|
+
<ste-progress :percentage="40" width="80%"></ste-progress>
|
|
34
|
+
<ste-progress :percentage="45" width="200"></ste-progress>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### 动画时间
|
|
38
|
+
```html
|
|
39
|
+
<ste-progress :percentage="p" duration="0.5"></ste-progress>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### 自定义文字内容
|
|
43
|
+
- 通过`pivotText`属性来自定义进度条内文字显示的内容
|
|
44
|
+
- 通过`textColor`属性来自定义进度条内文字的颜色
|
|
45
|
+
- 通过`textAlign`属性来自定义进度条内文字的对齐方式
|
|
46
|
+
- 通过`textSize`属性来自定义进度条内文字的大小
|
|
47
|
+
```html
|
|
48
|
+
<ste-progress :percentage="30" pivotText="已抢30%"></ste-progress>
|
|
49
|
+
<ste-progress :percentage="40" pivotText="已抢40%" textColor="#FF1E19"></ste-progress>
|
|
50
|
+
<ste-progress :percentage="45" pivotText="已抢45%" textAlign="left"></ste-progress>
|
|
51
|
+
<ste-progress :percentage="50" pivotText="已抢50%" textSize="20"></ste-progress>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### 文本显示阈值
|
|
55
|
+
- 当进度条百分比(`percentage`)小于阈值时(`displayTextThreshold`),进度条的内容将不会显示
|
|
56
|
+
- 默认阈值是`0`,此时内容将始终显示
|
|
57
|
+
```html
|
|
58
|
+
<ste-progress :percentage="14" :displayTextThreshold="15"></ste-progress>
|
|
59
|
+
<ste-progress :percentage="35" :displayTextThreshold="15"></ste-progress>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---$
|
|
63
|
+
### API
|
|
64
|
+
#### Props
|
|
65
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
66
|
+
| --- | --- | --- | --- | --- | --- |
|
|
67
|
+
|`activeBg` | 进度条激活部分的背景 | `String` | `#0090FF` | - | - |
|
|
68
|
+
|`inactiveBg` | 进度条未激活部分的背景 | `String` | `#eeeeee` | - | - |
|
|
69
|
+
|`percentage` | 进度条百分比 | `Number` | `0` | 0-100 | - |
|
|
70
|
+
|`strokeWidth` | 进度条的粗细,默认单位rpx | `String/Number` | `24rpx` | - | - |
|
|
71
|
+
|`disabled` | 是否禁用 | `Boolean` | `false` | - | - |
|
|
72
|
+
|`width` | 宽度 <br/>Number,单位rpx<br/>String,同原生<br/>默认宽度是`100%`,会根据父容器的宽度,如果父容器没有宽度将不会显示 | `String/Number` | `100%` | - | - |
|
|
73
|
+
|`duration` | 动画时间,单位秒,设置为 0 可以禁用动画 | `Number` | `0.3` | - | - |
|
|
74
|
+
|`pivotText` | 进度文字内容 | `String` | - | - | - |
|
|
75
|
+
|`textColor` | 进度文字颜色 | `String` | `#ffffff` | - | - |
|
|
76
|
+
|`textAlign` | 文本对齐方式 | `String` | `right` | `left` 居左<br/>`center` 居中 | - |
|
|
77
|
+
|`textSize` | 文本字体大小,默认单位rpx | `String/Number` | `16` | - | - |
|
|
78
|
+
|`displayTextThreshold` | 默认文本显示阈值 | `Number` | `0` | - | - |
|
|
79
|
+
|
|
80
|
+
#### Slots
|
|
81
|
+
|插槽名 |说明 |插槽参数 |支持版本 |
|
|
82
|
+
| --- | --- | --- | --- |
|
|
83
|
+
| `default` | 进度条内容 |- | - |
|
|
84
|
+
|
|
85
|
+
---$
|
|
86
|
+
|
|
87
|
+
{{fuyuwei}}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-progress-root" :style="[cmpRootCssVar]">
|
|
3
|
+
<view class="inactive-box" :style="[cmpInactiveStyle]"></view>
|
|
4
|
+
<view class="active-box line" :style="[cmpActiveStyle]" v-if="realPercentage > 0">
|
|
5
|
+
<slot v-if="haveSlot"></slot>
|
|
6
|
+
<text class="text" v-else>{{ cmpActiveText }}</text>
|
|
7
|
+
</view>
|
|
8
|
+
</view>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import utils from '../../utils/utils.js';
|
|
13
|
+
import useColor from '../../config/color.js';
|
|
14
|
+
let color = useColor();
|
|
15
|
+
/**
|
|
16
|
+
* ste-progress 进度条
|
|
17
|
+
* @description 进度条组件
|
|
18
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-progress
|
|
19
|
+
* @property {String} activeBg 进度条激活部分的背景 默认值 #0090FF
|
|
20
|
+
* @property {String} inactiveBg 进度条未激活部分的背景 默认值 #eeeeee
|
|
21
|
+
* @property {Number} percentage 进度条百分比 默认值 0
|
|
22
|
+
* @property {Number|String} strokeWidth 进度条的粗细,默认单位rpx 默认值 24
|
|
23
|
+
* @property {Boolean} disabled 是否禁用状态 默认 false
|
|
24
|
+
* @property {Number|String} width 进度条宽度 默认值 100%
|
|
25
|
+
* @property {Number} duration 进度条动画执行时间,单位秒,设置为 0 可以禁用动画 默认值 0.3
|
|
26
|
+
* @property {String} pivotText 进度文字内容
|
|
27
|
+
* @property {String} textColor 进度文字颜色 默认 #ffffff
|
|
28
|
+
* @property {String} textAlign 文本对齐方式 默认 right
|
|
29
|
+
* @property {String} textSize 文本字体大小,默认单位rpx 默认 16
|
|
30
|
+
* @property {Number} textSize 默认文本显示阈值 默认 0
|
|
31
|
+
*/
|
|
32
|
+
const MIN = 0;
|
|
33
|
+
const MAX = 100;
|
|
34
|
+
export default {
|
|
35
|
+
group: '数据组件',
|
|
36
|
+
title: 'Progress 进度条',
|
|
37
|
+
name: 'ste-progress',
|
|
38
|
+
props: {
|
|
39
|
+
activeBg: {
|
|
40
|
+
type: [String, null],
|
|
41
|
+
default: '',
|
|
42
|
+
},
|
|
43
|
+
inactiveBg: {
|
|
44
|
+
type: [String, null],
|
|
45
|
+
default: '#eeeeee',
|
|
46
|
+
},
|
|
47
|
+
percentage: {
|
|
48
|
+
type: [Number, null],
|
|
49
|
+
default: 0,
|
|
50
|
+
},
|
|
51
|
+
strokeWidth: {
|
|
52
|
+
type: [String, Number, null],
|
|
53
|
+
default: 24,
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: [Boolean, null],
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
width: {
|
|
60
|
+
type: [String, Number, null],
|
|
61
|
+
default: '100%',
|
|
62
|
+
},
|
|
63
|
+
duration: {
|
|
64
|
+
type: [Number, null],
|
|
65
|
+
default: 0.3,
|
|
66
|
+
},
|
|
67
|
+
pivotText: {
|
|
68
|
+
type: [String, null],
|
|
69
|
+
default: '',
|
|
70
|
+
},
|
|
71
|
+
textColor: {
|
|
72
|
+
type: [String, null],
|
|
73
|
+
default: '#ffffff',
|
|
74
|
+
},
|
|
75
|
+
textAlign: {
|
|
76
|
+
type: [String, null],
|
|
77
|
+
default: 'right',
|
|
78
|
+
},
|
|
79
|
+
textSize: {
|
|
80
|
+
type: [String, Number, null],
|
|
81
|
+
default: 16,
|
|
82
|
+
},
|
|
83
|
+
displayTextThreshold: {
|
|
84
|
+
type: [Number, null],
|
|
85
|
+
default: 0,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
data() {
|
|
89
|
+
return {
|
|
90
|
+
realPercentage: 0,
|
|
91
|
+
haveSlot: false,
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
created() {},
|
|
95
|
+
mounted() {
|
|
96
|
+
this.haveSlot = this.$slots.default;
|
|
97
|
+
},
|
|
98
|
+
computed: {
|
|
99
|
+
cmpRootCssVar() {
|
|
100
|
+
const style = {
|
|
101
|
+
'--progress-width': utils.addUnit(this.width),
|
|
102
|
+
'--progress-height': utils.addUnit(this.strokeWidth),
|
|
103
|
+
// #ifdef MP-WEIXIN || MP-ALIPAY
|
|
104
|
+
'--progress-padding': this.$slots.default ? '0' : '0 16rpx',
|
|
105
|
+
// #endif
|
|
106
|
+
// #ifdef H5
|
|
107
|
+
'--progress-padding': this.$slots.default ? '0' : '0 8px',
|
|
108
|
+
// #endif
|
|
109
|
+
'--active-width': this.realPercentage + '%',
|
|
110
|
+
'--active-text-align': this.textAlign == 'right' ? 'flex-end' : this.textAlign,
|
|
111
|
+
'--active-text-color': this.textColor,
|
|
112
|
+
'--active-text-font-size': utils.addUnit(this.textSize),
|
|
113
|
+
'--active-transition-duration': `${this.duration}s`,
|
|
114
|
+
};
|
|
115
|
+
return style;
|
|
116
|
+
},
|
|
117
|
+
cmpInactiveStyle() {
|
|
118
|
+
let style = {};
|
|
119
|
+
if (this.disabled) {
|
|
120
|
+
style.backgroundColor = '#eeeeee';
|
|
121
|
+
} else {
|
|
122
|
+
const bg = utils.bg2style(this.inactiveBg);
|
|
123
|
+
style = { ...style, ...bg };
|
|
124
|
+
}
|
|
125
|
+
return style;
|
|
126
|
+
},
|
|
127
|
+
cmpActiveStyle() {
|
|
128
|
+
let style = {};
|
|
129
|
+
if (this.disabled) {
|
|
130
|
+
style.backgroundColor = '#cccccc';
|
|
131
|
+
} else {
|
|
132
|
+
const bg = utils.bg2style(this.activeBg ? this.activeBg : color.getColor().steThemeColor);
|
|
133
|
+
style = { ...style, ...bg };
|
|
134
|
+
}
|
|
135
|
+
return style;
|
|
136
|
+
},
|
|
137
|
+
cmpActiveText() {
|
|
138
|
+
let str = this.pivotText ? this.pivotText : this.realPercentage <= MIN ? '' : `${this.realPercentage}%`;
|
|
139
|
+
if (this.displayTextThreshold > 0 && this.realPercentage < this.displayTextThreshold) {
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
return str;
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
watch: {
|
|
146
|
+
percentage: {
|
|
147
|
+
handler(val) {
|
|
148
|
+
if (this.percentage >= MAX) {
|
|
149
|
+
this.realPercentage = MAX;
|
|
150
|
+
} else if (this.percentage <= MIN) {
|
|
151
|
+
this.realPercentage = MIN;
|
|
152
|
+
} else {
|
|
153
|
+
this.realPercentage = val;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
immediate: true,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
methods: {},
|
|
160
|
+
};
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<style lang="scss" scoped>
|
|
164
|
+
.ste-progress-root {
|
|
165
|
+
position: relative;
|
|
166
|
+
width: var(--progress-width);
|
|
167
|
+
height: var(--progress-height);
|
|
168
|
+
|
|
169
|
+
.inactive-box,
|
|
170
|
+
.active-box {
|
|
171
|
+
width: var(--progress-width);
|
|
172
|
+
height: var(--progress-height);
|
|
173
|
+
border-radius: 24rpx;
|
|
174
|
+
|
|
175
|
+
background-repeat: repeat;
|
|
176
|
+
background-size: contain;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.active-box {
|
|
180
|
+
width: var(--active-width);
|
|
181
|
+
position: absolute;
|
|
182
|
+
left: 0;
|
|
183
|
+
top: 0;
|
|
184
|
+
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: var(--active-text-align);
|
|
188
|
+
padding: var(--progress-padding);
|
|
189
|
+
|
|
190
|
+
transition: width var(--active-transition-duration) ease;
|
|
191
|
+
|
|
192
|
+
.text {
|
|
193
|
+
color: var(--active-text-color);
|
|
194
|
+
font-size: var(--active-text-font-size);
|
|
195
|
+
vertical-align: middle;
|
|
196
|
+
line-height: 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# QRcode 二维码
|
|
2
|
+
能够将文本转换生成二维码的组件,支持自定义配色和 Logo 配置
|
|
3
|
+
|
|
4
|
+
---$
|
|
5
|
+
|
|
6
|
+
### 代码演示
|
|
7
|
+
#### 基础使用
|
|
8
|
+
```html
|
|
9
|
+
<ste-qrcode content="https://stellar-ui.intecloud.com.cn/mp/index/index" />
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
#### 自定义颜色
|
|
13
|
+
```html
|
|
14
|
+
<ste-qrcode
|
|
15
|
+
content="https://stellar-ui.intecloud.com.cn/mp/index/index"
|
|
16
|
+
foreground="#c11"
|
|
17
|
+
background="#dad"
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### 带logo
|
|
22
|
+
```html
|
|
23
|
+
<ste-qrcode
|
|
24
|
+
content="https://stellar-ui.intecloud.com.cn/mp/index/index"
|
|
25
|
+
foregroundImageSrc="https://image.whzb.com/chain/StellarUI/logo.png"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
---$
|
|
32
|
+
### API
|
|
33
|
+
#### Props
|
|
34
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
35
|
+
| --- | --- | --- | --- | --- | --- |
|
|
36
|
+
| `content` | 二维码内容 | `String` | - | - | `v1.35.4` |
|
|
37
|
+
| `size` | 二维码尺寸,单位`px` | `Number` | 200 | - | `v1.35.4` |
|
|
38
|
+
| `background` | 背景色 | `String` | `#fff` | - | `v1.35.4` |
|
|
39
|
+
| `foreground` | 前景色(二维码画笔颜色) | `String` | `#000` | - | `v1.35.4` |
|
|
40
|
+
| `foregroundImageSrc` | 二维码中间logo图 | `String` | - | - | `v1.35.4` |
|
|
41
|
+
| `foregroundImageWidth` | logo图宽度, 默认二维码尺寸的四分之一 | `Number` | `size/4` | - | `v1.35.4` |
|
|
42
|
+
| `foregroundImageHeight` | logo图高度, 默认二维码尺寸的四分之一 | `Number` | `size/4` | - | `v1.35.4` |
|
|
43
|
+
|
|
44
|
+
#### Events
|
|
45
|
+
|事件名 |说明 |事件参数 |支持版本 |
|
|
46
|
+
| --- | --- | --- | --- |
|
|
47
|
+
| `loadImage` | `二维码获取图片数据` | `src` | `v1.35.4` |
|
|
48
|
+
|
|
49
|
+
---$
|
|
50
|
+
{{fuyuwei}}
|