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.
Files changed (141) hide show
  1. package/common/css/common.scss +61 -0
  2. package/components/ste-animate/README.md +117 -0
  3. package/components/ste-animate/animate.scss +247 -0
  4. package/components/ste-animate/ste-animate.vue +200 -0
  5. package/components/ste-badge/README.md +171 -0
  6. package/components/ste-badge/ste-badge.vue +238 -0
  7. package/components/ste-barcode/README.md +36 -0
  8. package/components/ste-barcode/encode2.js +317 -0
  9. package/components/ste-barcode/ste-barcode.vue +213 -0
  10. package/components/ste-button/README.md +129 -0
  11. package/components/ste-button/ste-button.vue +345 -0
  12. package/components/ste-calendar/README.md +304 -0
  13. package/components/ste-calendar/self-date.js +119 -0
  14. package/components/ste-calendar/ste-calendar.vue +578 -0
  15. package/components/ste-checkbox/README.md +297 -0
  16. package/components/ste-checkbox/ste-checkbox.vue +305 -0
  17. package/components/ste-checkbox-group/ste-checkbox-group.vue +133 -0
  18. package/components/ste-code-input/README.md +67 -0
  19. package/components/ste-code-input/ste-code-input.vue +302 -0
  20. package/components/ste-date-picker/README.md +135 -0
  21. package/components/ste-date-picker/ste-date-picker.vue +407 -0
  22. package/components/ste-drag/README.md +103 -0
  23. package/components/ste-drag/ste-drag.vue +203 -0
  24. package/components/ste-dropdown-menu/README.md +358 -0
  25. package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -0
  26. package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -0
  27. package/components/ste-icon/README.md +90 -0
  28. package/components/ste-icon/iconfont.css +8 -0
  29. package/components/ste-icon/ste-icon.vue +147 -0
  30. package/components/ste-image/README.md +154 -0
  31. package/components/ste-image/ste-image.vue +218 -0
  32. package/components/ste-index-item/ste-index-item.vue +96 -0
  33. package/components/ste-index-list/README.md +153 -0
  34. package/components/ste-index-list/ste-index-list.vue +128 -0
  35. package/components/ste-input/README.md +146 -0
  36. package/components/ste-input/ste-input.vue +480 -0
  37. package/components/ste-loading/README.md +81 -0
  38. package/components/ste-loading/ste-loading.vue +166 -0
  39. package/components/ste-media-preview/README.md +243 -0
  40. package/components/ste-media-preview/TouchScaleing.js +102 -0
  41. package/components/ste-media-preview/ste-media-preview.vue +267 -0
  42. package/components/ste-message-box/README.md +217 -0
  43. package/components/ste-message-box/ste-message-box.js +72 -0
  44. package/components/ste-message-box/ste-message-box.vue +380 -0
  45. package/components/ste-notice-bar/README.md +129 -0
  46. package/components/ste-notice-bar/ste-notice-bar.vue +331 -0
  47. package/components/ste-number-keyboard/README.md +246 -0
  48. package/components/ste-number-keyboard/keyboard.vue +140 -0
  49. package/components/ste-number-keyboard/ste-number-keyboard.vue +240 -0
  50. package/components/ste-picker/ste-picker.vue +258 -0
  51. package/components/ste-popup/README.md +148 -0
  52. package/components/ste-popup/ste-popup.vue +337 -0
  53. package/components/ste-price/README.md +129 -0
  54. package/components/ste-price/ste-price.vue +258 -0
  55. package/components/ste-progress/README.md +87 -0
  56. package/components/ste-progress/ste-progress.vue +200 -0
  57. package/components/ste-qrcode/README.md +50 -0
  58. package/components/ste-qrcode/ste-qrcode.vue +164 -0
  59. package/components/ste-qrcode/uqrcode.js +34 -0
  60. package/components/ste-radio/README.md +286 -0
  61. package/components/ste-radio/ste-radio.vue +293 -0
  62. package/components/ste-radio-group/ste-radio-group.vue +128 -0
  63. package/components/ste-rate/README.md +115 -0
  64. package/components/ste-rate/ste-rate.vue +202 -0
  65. package/components/ste-read-more/README.md +111 -0
  66. package/components/ste-read-more/ste-read-more.vue +133 -0
  67. package/components/ste-rich-text/README.md +31 -0
  68. package/components/ste-rich-text/ste-rich-text.vue +70 -0
  69. package/components/ste-scroll-to/README.md +68 -0
  70. package/components/ste-scroll-to/mixin.js +173 -0
  71. package/components/ste-scroll-to/ste-scroll-to.vue +45 -0
  72. package/components/ste-scroll-to-item/ste-scroll-to-item.vue +25 -0
  73. package/components/ste-search/README.md +262 -0
  74. package/components/ste-search/ste-search.vue +547 -0
  75. package/components/ste-select/README.md +434 -0
  76. package/components/ste-select/datapager.vue +62 -0
  77. package/components/ste-select/datetime.vue +106 -0
  78. package/components/ste-select/defaultDate.js +142 -0
  79. package/components/ste-select/ste-select.vue +843 -0
  80. package/components/ste-signature/README.md +105 -0
  81. package/components/ste-signature/ste-signature.vue +220 -0
  82. package/components/ste-slider/README.md +165 -0
  83. package/components/ste-slider/ste-slider.vue +544 -0
  84. package/components/ste-step/ste-step.vue +264 -0
  85. package/components/ste-stepper/README.md +170 -0
  86. package/components/ste-stepper/ste-stepper.vue +373 -0
  87. package/components/ste-steps/README.md +132 -0
  88. package/components/ste-steps/ste-steps.vue +65 -0
  89. package/components/ste-sticky/README.md +52 -0
  90. package/components/ste-sticky/ste-sticky.vue +127 -0
  91. package/components/ste-swipe-action/README.md +197 -0
  92. package/components/ste-swipe-action/ste-swipe-action.vue +303 -0
  93. package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -0
  94. package/components/ste-swiper/README.md +173 -0
  95. package/components/ste-swiper/ste-swiper.vue +462 -0
  96. package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
  97. package/components/ste-switch/README.md +110 -0
  98. package/components/ste-switch/ste-switch.vue +144 -0
  99. package/components/ste-tab/ste-tab.vue +87 -0
  100. package/components/ste-table/README.md +785 -0
  101. package/components/ste-table/common.js +8 -0
  102. package/components/ste-table/ste-table.vue +666 -0
  103. package/components/ste-table/utils.js +20 -0
  104. package/components/ste-table-column/checkbox-icon.vue +65 -0
  105. package/components/ste-table-column/common.scss +65 -0
  106. package/components/ste-table-column/radio-icon.vue +110 -0
  107. package/components/ste-table-column/ste-table-column.vue +255 -0
  108. package/components/ste-table-column/sub-table.vue +116 -0
  109. package/components/ste-table-column/table-popover.vue +204 -0
  110. package/components/ste-table-column/var.scss +1 -0
  111. package/components/ste-tabs/README.md +475 -0
  112. package/components/ste-tabs/props.js +212 -0
  113. package/components/ste-tabs/ste-tabs.vue +758 -0
  114. package/components/ste-text/README.md +66 -0
  115. package/components/ste-text/ste-text.vue +72 -0
  116. package/components/ste-toast/README.md +243 -0
  117. package/components/ste-toast/ste-toast.js +69 -0
  118. package/components/ste-toast/ste-toast.vue +231 -0
  119. package/components/ste-touch-swipe/README.md +104 -0
  120. package/components/ste-touch-swipe/TouchEvent.js +72 -0
  121. package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -0
  122. package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -0
  123. package/components/ste-tour/README.md +194 -0
  124. package/components/ste-tour/ste-tour.vue +355 -0
  125. package/components/ste-tree/README.md +240 -0
  126. package/components/ste-tree/ste-tree.vue +350 -0
  127. package/components/ste-upload/README.md +276 -0
  128. package/components/ste-upload/ReadFile.js +229 -0
  129. package/components/ste-upload/ste-upload.vue +526 -0
  130. package/components/ste-video/README.md +60 -0
  131. package/components/ste-video/props.js +149 -0
  132. package/components/ste-video/ste-video.vue +647 -0
  133. package/config/color.js +22 -0
  134. package/index.js +2 -0
  135. package/package.json +19 -0
  136. package/utils/Color.js +66 -0
  137. package/utils/System.js +110 -0
  138. package/utils/dayjs.min.js +1 -0
  139. package/utils/mixin.js +67 -0
  140. package/utils/store.js +7 -0
  141. package/utils/utils.js +604 -0
@@ -0,0 +1,480 @@
1
+ <template>
2
+ <view class="ste-input-root" :class="cmpRootClass" :style="[cmpRootStyle, cmpRootCssVar]">
3
+ <view class="content" @click="inputClick">
4
+ <view class="prefix-box">
5
+ <slot name="prefix"></slot>
6
+ </view>
7
+ <view class="input-box">
8
+ <template v-if="type == 'textarea'">
9
+ <textarea
10
+ class="ste-input-input textarea"
11
+ :type="type"
12
+ :focus="focus"
13
+ v-model="dataValue"
14
+ :disabled="disabled || readonly"
15
+ :placeholder="placeholder"
16
+ :placeholder-style="placeholderStyle"
17
+ :placeholder-class="placeholderClass"
18
+ :confirm-type="confirmType"
19
+ :cursor-spacing="cursorSpacing"
20
+ @input="onInput"
21
+ @focus="onFocus"
22
+ @blur="onBlur"
23
+ @confirm="onConfirm"
24
+ />
25
+ <!-- #ifdef H5 || MP-WEIXIN -->
26
+ <text
27
+ class="count-text"
28
+ :style="{
29
+ 'background-color': 'transparent',
30
+ }"
31
+ v-if="showWordLimit && maxlength > 0"
32
+ >
33
+ {{ tmpDataValue.length }}/{{ maxlength }}
34
+ </text>
35
+ <!-- #endif -->
36
+ </template>
37
+ <template v-else>
38
+ <input
39
+ class="ste-input-input"
40
+ :type="type"
41
+ :focus="focused"
42
+ v-model="dataValue"
43
+ :disabled="disabled || readonly"
44
+ :placeholder="placeholder"
45
+ :placeholder-style="placeholderStyle"
46
+ :placeholder-class="placeholderClass"
47
+ :confirm-type="confirmType"
48
+ @input="onInput"
49
+ @focus="onFocus"
50
+ @blur="onBlur"
51
+ @confirm="onConfirm"
52
+ :style="[{ width: cmpShowClear ? 'calc(100% - 48rpx)' : 'calc(100% - 8rpx)' }]"
53
+ :cursor-spacing="cursorSpacing"
54
+ :cursor="cursorNumber"
55
+ />
56
+ <view v-if="cmpShowClear" class="clear-icon" @click="onClear">
57
+ <ste-icon code="&#xe694;" color="#bbbbbb" size="34" />
58
+ </view>
59
+ </template>
60
+ </view>
61
+ <view class="suffix-box">
62
+ <slot name="suffix"></slot>
63
+ </view>
64
+ </view>
65
+ <view class="line" v-if="shape == 'line'" />
66
+ </view>
67
+ </template>
68
+
69
+ <script>
70
+ import utils from '../../utils/utils.js';
71
+ /**
72
+ * ste-input 输入框
73
+ * @description 输入框组件
74
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-input
75
+ * @property {Number|String} value 初始内容,支持双向绑定
76
+ * @property {String} type 输入框类型
77
+ * @value text 纯文本输入 {String}
78
+ * @value textarea 文本域 {String}
79
+ * @value tel 电话输入 {String}
80
+ * @value number 数字输入 {String}
81
+ * @value idcard 身份证输入键盘 {String}
82
+ * @value digit 小数点的数字键盘 {String}
83
+ * @value password 密码类型 {String}
84
+ * @value nickname 昵称输入(微信小程序) {String}
85
+ * @value numberpad 仅支付宝小程序 {String}
86
+ * @value digitpad 仅支付宝小程序 {String}
87
+ * @value idcardpad 仅支付宝小程序 {String}
88
+ * @property {String} placeholder 占位符
89
+ * @property {String|Object} placeholderStyle 指定placeholder的样式
90
+ * @property {String} placeholderClass 指定placeholder的类
91
+ * @property {Boolean} disabled 是否禁用
92
+ * @property {Boolean} clearable 是否有清空按钮
93
+ * @property {Number} maxlength 最大长度
94
+ * @property {Boolean} showWordLimit 是否显示字数统计
95
+ * @property {String} confirmType 设置右下角按钮的文字
96
+ * @value send 右下角按钮为"发送" {String}
97
+ * @value search 右下角按钮为"搜索" {String}
98
+ * @value next 右下角按钮为"下一个" {String}
99
+ * @value go 右下角按钮为"前往" {String}
100
+ * @value done 右下角按钮为"完成" {String}
101
+ * @property {Boolean} focus 是否聚焦,支持双向绑定
102
+ * @property {String} inputAlign 对齐方式
103
+ * @value left 向左对齐 {String}
104
+ * @value center 居中对齐 {String}
105
+ * @value right 向右对齐{String}
106
+ * @property {Number|String} fontSize 输入框字体大小,单位rpx
107
+ * @property {String} fontColor 输入框字体颜色
108
+ * @property {Boolean} readonly 是否只读,与禁用不同,只读不会置灰
109
+ * @property {String} shape 输入框形状
110
+ * @value square 方形 {String}
111
+ * @value circle 圆形 {String}
112
+ * @value line 线形 {String}
113
+ * @property {Boolean} border 是否有边框
114
+ * @property {String} borderColor 边框颜色
115
+ * @property {String} background 输入框背景色
116
+ * @property {String} rootClass 自定义输入框类名
117
+ * @property {Number} cursorSpacing 指定光标与键盘的距离
118
+ * @property {Boolean} allowSpace 是否允许输入空格
119
+ * @event {Function} blur 输入框失去焦点时触发
120
+ * @event {Function} focus 输入框聚焦时触发
121
+ * @event {Function} confirm 输入键盘点击右下角触发
122
+ * @event {Function} clear 输入框清空触发
123
+ * @event {Function} input 输入框输入事件
124
+ */
125
+ export default {
126
+ group: '表单组件',
127
+ title: 'Input 输入框',
128
+ name: 'ste-input',
129
+ options: {
130
+ virtualHost: true,
131
+ },
132
+ props: {
133
+ value: {
134
+ type: [String, Number, null],
135
+ default: '',
136
+ },
137
+ type: {
138
+ type: [String, null],
139
+ default: 'text',
140
+ },
141
+ placeholder: {
142
+ type: [String, null],
143
+ default: '',
144
+ },
145
+ placeholderStyle: {
146
+ type: [String, Object, null],
147
+ default: 'color: #BBBBBB',
148
+ },
149
+ placeholderClass: {
150
+ type: [String, null],
151
+ default: 'ste-input-placeholder',
152
+ },
153
+ disabled: {
154
+ type: [Boolean, null],
155
+ default: false,
156
+ },
157
+ clearable: {
158
+ type: [Boolean, null],
159
+ default: true,
160
+ },
161
+ maxlength: {
162
+ type: [Number, null],
163
+ default: -1,
164
+ },
165
+ showWordLimit: {
166
+ type: [Boolean, null],
167
+ default: false,
168
+ },
169
+ confirmType: {
170
+ type: [String, null],
171
+ default: 'done',
172
+ },
173
+ focus: {
174
+ type: [Boolean, null],
175
+ default: false,
176
+ },
177
+ inputAlign: {
178
+ type: [String, null],
179
+ default: 'left',
180
+ },
181
+ fontSize: {
182
+ type: [String, Number, null],
183
+ default: 24,
184
+ },
185
+ fontColor: {
186
+ type: [String, null],
187
+ default: '#000000',
188
+ },
189
+ readonly: {
190
+ type: [Boolean, null],
191
+ default: false,
192
+ },
193
+ shape: {
194
+ type: [String, null],
195
+ default: 'square',
196
+ },
197
+ border: {
198
+ type: [Boolean, null],
199
+ default: false,
200
+ },
201
+ borderColor: {
202
+ type: [String, null],
203
+ default: '',
204
+ },
205
+ background: {
206
+ type: [String, null],
207
+ default: '',
208
+ },
209
+ rootClass: {
210
+ type: [String, null],
211
+ default: '',
212
+ },
213
+ cursorSpacing: {
214
+ type: [Number, null],
215
+ default: 20,
216
+ },
217
+ allowSpace: {
218
+ type: [Boolean, null],
219
+ default: true,
220
+ },
221
+ cursor: {
222
+ type: [Number, null],
223
+ default: 0,
224
+ },
225
+ },
226
+ data() {
227
+ return {
228
+ dataValue: '',
229
+ tmpDataValue: '', // 用于记录输入值,type="textarea"时显示字数长度(直接使用dataValue时某些情况可能出现输入延迟)
230
+ focused: this.focus,
231
+ cursorNumber: 0,
232
+ };
233
+ },
234
+ created() {},
235
+ mounted() {},
236
+ computed: {
237
+ cmpRootClass() {
238
+ let classStr = '';
239
+ if (this.disabled) {
240
+ classStr += 'ste-input-disabled ';
241
+ }
242
+ if (this.readonly) {
243
+ classStr += 'ste-input-readonly ';
244
+ }
245
+
246
+ classStr += `ste-input-${this.shape} `;
247
+
248
+ if (this.rootClass) {
249
+ classStr += `${this.rootClass} `;
250
+ }
251
+
252
+ if (this.type == 'textarea') {
253
+ classStr += 'textarea-type ';
254
+ }
255
+
256
+ return classStr;
257
+ },
258
+ cmpRootStyle() {
259
+ let style = utils.bg2style(this.background);
260
+
261
+ switch (this.shape) {
262
+ case 'circle':
263
+ style.borderRadius = utils.addUnit(40);
264
+ break;
265
+ case 'square':
266
+ style.borderRadius = utils.addUnit(16);
267
+ break;
268
+ default:
269
+ break;
270
+ }
271
+ return style;
272
+ },
273
+ cmpRootCssVar() {
274
+ let style = {
275
+ '--input-font-size': utils.addUnit(this.fontSize),
276
+ '--input-font-color': this.fontColor,
277
+ '--input-text-align': this.inputAlign,
278
+ '--input-line-color': this.borderColor || '#eeeeee',
279
+ '--input-border-color': this.border ? this.borderColor : 'transparent',
280
+ };
281
+ return style;
282
+ },
283
+
284
+ cmpShowClear() {
285
+ return !this.disabled && !this.readonly && this.clearable && this.dataValue && this.focused;
286
+ },
287
+ },
288
+ methods: {
289
+ onInput(e) {
290
+ if (!this.disabled && !this.readonly) {
291
+ if (!this.allowSpace) {
292
+ e.detail.value = e.detail.value.replace(/\s*/g, '');
293
+ }
294
+ this.$nextTick(() => {
295
+ if (this.maxlength > 0) {
296
+ this.dataValue = e.detail.value.substring(0, this.maxlength);
297
+ }
298
+ this.tmpDataValue = this.dataValue;
299
+ this.$emit('input', this.dataValue);
300
+ });
301
+ }
302
+ },
303
+ onClear() {
304
+ if (this.disabled && !this.readonly) return;
305
+
306
+ this.dataValue = '';
307
+ this.$emit('input', this.dataValue);
308
+ this.$emit('clear');
309
+ },
310
+ onFocus() {
311
+ if (this.disabled && !this.readonly) return;
312
+ this.focused = true;
313
+ this.$emit('update:focus', true);
314
+ this.$emit('focus', this.dataValue);
315
+ },
316
+ onBlur() {
317
+ setTimeout(() => {
318
+ this.$emit('update:focus', false);
319
+ this.focused = false;
320
+ this.$emit('blur', this.dataValue);
321
+ }, 200);
322
+ },
323
+ onConfirm() {
324
+ this.$emit('confirm', this.dataValue);
325
+ },
326
+ inputClick() {
327
+ this.onFocus();
328
+ },
329
+ },
330
+ watch: {
331
+ value: {
332
+ handler(val) {
333
+ this.dataValue = val;
334
+ this.tmpDataValue = val;
335
+ },
336
+ immediate: true,
337
+ },
338
+ focus: {
339
+ handler(val) {
340
+ setTimeout(() => {
341
+ this.focused = val;
342
+ }, 50);
343
+ },
344
+ },
345
+ cursor: {
346
+ handler(val) {
347
+ this.cursorNumber = val;
348
+ },
349
+ immediate: true,
350
+ },
351
+ },
352
+ };
353
+ </script>
354
+
355
+ <style lang="scss" scoped>
356
+ .ste-input-root {
357
+ position: relative;
358
+ box-sizing: border-box;
359
+ border-width: 1rpx;
360
+ border-style: solid;
361
+ border-color: var(--input-border-color);
362
+ background-color: #ffffff;
363
+ .content {
364
+ display: flex;
365
+ align-items: center;
366
+ padding: 0 24rpx;
367
+ .suffix-box,
368
+ .prefix-box {
369
+ display: flex;
370
+ flex-direction: column;
371
+ flex-shrink: 0;
372
+ flex-grow: 0;
373
+ flex-basis: auto;
374
+ align-items: stretch;
375
+
376
+ font-size: var(--input-font-size);
377
+ }
378
+ .input-box {
379
+ position: relative;
380
+ width: 100%;
381
+
382
+ .clear-icon {
383
+ width: 48rpx;
384
+ height: 100%;
385
+ display: flex;
386
+ align-items: center;
387
+ justify-content: flex-end;
388
+ position: absolute;
389
+ right: 8rpx;
390
+ top: 50%;
391
+ z-index: 2;
392
+ transform: translateY(-50%);
393
+ }
394
+
395
+ .ste-input-input {
396
+ outline: none;
397
+ border: none;
398
+ padding: 0;
399
+ margin: 0;
400
+ height: calc(var(--input-font-size) * 2.8);
401
+ width: 100%;
402
+
403
+ font-size: var(--input-font-size);
404
+ color: var(--input-font-color);
405
+
406
+ text-align: var(--input-text-align);
407
+
408
+ background-color: transparent;
409
+
410
+ // letter-spacing: 10rpx;
411
+
412
+ &.textarea {
413
+ height: 160rpx;
414
+ }
415
+ }
416
+
417
+ .count-text {
418
+ position: absolute;
419
+ bottom: 0;
420
+ right: 0;
421
+ font-size: 24rpx;
422
+ color: #bbbbbb;
423
+ }
424
+ }
425
+ }
426
+
427
+ &.ste-input-readonly {
428
+ cursor: not-allowed;
429
+ .ste-input-input {
430
+ cursor: not-allowed;
431
+ }
432
+ }
433
+ &.ste-input-disabled {
434
+ cursor: not-allowed;
435
+ .ste-input-input {
436
+ cursor: not-allowed;
437
+ color: #cccccc !important;
438
+ }
439
+ }
440
+
441
+ &.ste-input-line {
442
+ background-color: transparent;
443
+ border: none;
444
+ border-color: transparent;
445
+
446
+ .content {
447
+ padding: 0 0;
448
+ }
449
+
450
+ .line {
451
+ border-bottom: 2rpx solid var(--input-line-color);
452
+ }
453
+ }
454
+
455
+ &.ste-search-input {
456
+ height: 100%;
457
+
458
+ // #ifdef MP-ALIPAY
459
+ background-color: rgba(0, 0, 0, 0);
460
+ // #endif
461
+
462
+ .content {
463
+ padding: 0;
464
+ height: 100%;
465
+ }
466
+ }
467
+
468
+ &.textarea-type {
469
+ height: 100%;
470
+ .content {
471
+ padding: 20rpx 24rpx;
472
+ height: 100%;
473
+
474
+ .input-box {
475
+ height: 100%;
476
+ }
477
+ }
478
+ }
479
+ }
480
+ </style>
@@ -0,0 +1,81 @@
1
+ # Loading 加载动画
2
+
3
+ 加载动画,用于表示加载中的过渡状态。
4
+
5
+ ---$
6
+
7
+ ## 代码演示
8
+
9
+ ### 加载类型
10
+ 通过 `type`设置加载动画类型,默认为类型`1`
11
+ - `1`:逐渐减淡的颜色为主色的透明度变化 透明度以10%的差距逐渐递减
12
+ - `2`:动态转圈展示
13
+
14
+ ```html
15
+ <ste-loading></ste-loading>
16
+ <ste-loading :type="2"></ste-loading>
17
+ ```
18
+
19
+ ### 自定义图标颜色
20
+ 通过 `color` 属性来设置图标的颜色
21
+
22
+ ```html
23
+ <ste-loading color="#0090FF"></ste-loading>
24
+ <ste-loading :type="2" color="#0090FF"></ste-loading>
25
+ ```
26
+
27
+ ### 自定义图标大小
28
+ 通过 `size` 属性来设置图标的尺寸大小,单位为 rpx,默认`60`
29
+
30
+ ```html
31
+ <ste-loading :size="100"></ste-loading>
32
+ <ste-loading :type="2" :size="100"></ste-loading>
33
+ ```
34
+
35
+ ### 加载文案
36
+ 默认插槽`default`为加载文案
37
+ ```html
38
+ <ste-loading>加载中...</ste-loading>
39
+ <ste-loading :type="2">加载中...</ste-loading>
40
+ ```
41
+
42
+ ### 垂直排列
43
+ 通过 `vertical` 是否垂直排列图标和文字内容,默认`false`
44
+
45
+ ```html
46
+ <ste-loading vertical>加载中...</ste-loading>
47
+ <ste-loading :type="2" vertical>加载中...</ste-loading>
48
+ ```
49
+
50
+ ### 自定义文本样式
51
+ - 通过 `textSize`设置文本大小,单位rpx,默认为`28`
52
+ - 通过 `textColor`设置文本颜色,默认和图标颜色同步
53
+
54
+ ```html
55
+ <ste-loading :textSize="50" textColor="#0090FF">加载中...</ste-loading>
56
+ <ste-loading :type="2" :textSize="50" textColor="#0090FF">加载中...</ste-loading>
57
+ ```
58
+
59
+ ---$
60
+ ### API
61
+
62
+ #### Props
63
+
64
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
65
+ | ----- | ----- | ----- | ----- | ----- | ----- |
66
+ | `type` | 类型 | `Number` | `1` | `1`:逐渐减淡的颜色为主色的透明度变化 透明度以10%的差距逐渐递减 <br>`2`:动态转圈展示 | - |
67
+ | `color` | 图标颜色 | `String` | `#999999` | - | - |
68
+ | `size` | 图标大小,单位rpx | `Number` | `60` | - | - |
69
+ | `textColor` | 文本颜色,默认和图标颜色同步 | `String` | - | - | - |
70
+ | `textSize` | 文本大小,单位rpx | `Number` | `28` | - | - |
71
+ | `vertical` | 是否垂直排列图标和文字内容 | `Boolean` | `false` | - | - |
72
+
73
+ #### 组件插槽(Slots)
74
+
75
+ |插槽名 |说明 |插槽参数 |支持版本 |
76
+ |--- |--- |--- |--- |
77
+ | `default` | 加载文案 | - | - |
78
+
79
+
80
+ ---$
81
+ {{qinpengfei}}
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <view class="ste-loading-root" :style="[cmpStyle]">
3
+ <view :class="'loading ' + 'loading-type-' + type" :style="[cmpLoadinStyle]">
4
+ <block v-if="type == 1">
5
+ <i
6
+ v-for="item in cmpCount"
7
+ class="i"
8
+ :key="item"
9
+ :style="{ transform: `rotate(${item * 40 + 80}deg)`, opacity: item == 0 ? 1 : (item + 1) / 10 }"
10
+ ></i>
11
+ </block>
12
+ <block v-if="type == 2">
13
+ <view></view>
14
+ </block>
15
+ </view>
16
+ <view v-if="$slots.default" class="text" :style="[cmpText]">
17
+ <slot></slot>
18
+ </view>
19
+ </view>
20
+ </template>
21
+
22
+ <script>
23
+ import utils from '../../utils/utils.js';
24
+ /**
25
+ * ste-loading 加载
26
+ * @description 加载组件,用于表示加载中的过渡状态。
27
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-loading
28
+ * @property {String} color 图标颜色,默认#999999
29
+ * @property {String} textColor 提示文本颜色,默认和图标颜色同步
30
+ * @property {Number} textSize 文本大小,单位rpx,默认28
31
+ * @property {Number} type 类型,默认1
32
+ * @value 1 逐渐减淡的颜色为主色的透明度变化 透明度以10%的差距逐渐递减{{Number}}
33
+ * @value 2 动态转圈展示{{Number}}
34
+ * @property {Number} size 图标大小,单位rpx,默认60
35
+ * @property {Boolean} vertical 是否垂直排列图标和文字内容,默认false
36
+ */
37
+ export default {
38
+ group: '展示组件',
39
+ title: 'Loading 加载动画',
40
+ name: 'ste-loading',
41
+ props: {
42
+ color: {
43
+ type: [String, null],
44
+ default: () => '#999999',
45
+ },
46
+ textColor: {
47
+ type: [String, null],
48
+ default: () => '',
49
+ },
50
+ textSize: {
51
+ type: [Number, null],
52
+ default: () => 28,
53
+ },
54
+ type: {
55
+ type: [Number, null],
56
+ default: () => 1,
57
+ },
58
+ size: {
59
+ type: [Number, null],
60
+ default: () => 60,
61
+ },
62
+ vertical: {
63
+ type: [Boolean, null],
64
+ default: () => false,
65
+ },
66
+ },
67
+ data() {
68
+ return {
69
+ count: 9,
70
+ };
71
+ },
72
+ computed: {
73
+ cmpStyle() {
74
+ let style = {};
75
+ style['flexDirection'] = this.vertical ? 'column' : 'row';
76
+ return style;
77
+ },
78
+ cmpLoadinStyle() {
79
+ let style = {};
80
+ style['width'] = utils.formatPx(this.size);
81
+ style['height'] = utils.formatPx(this.size);
82
+ style['color'] = this.color;
83
+ if (this.type == 1) {
84
+ style['animationTimingFunction'] = 'steps(8)';
85
+ }
86
+ if (this.type == 2) {
87
+ style['border'] = `${utils.formatPx(4)} solid`;
88
+ style['borderColor'] = (this.color + ' ').repeat(3) + 'transparent';
89
+ }
90
+ return style;
91
+ },
92
+ cmpCount() {
93
+ // 兼容浏览器和微信 对数字循环的处理不同
94
+ return Array.from({ length: this.count }, (_, index) => index);
95
+ },
96
+ cmpText() {
97
+ let style = {};
98
+ style['color'] = this.textColor ? this.textColor : this.color;
99
+ style['fontSize'] = utils.formatPx(this.textSize);
100
+ style['margin'] = this.vertical ? '16rpx 0 0 0 ' : '0 0 0 16rpx';
101
+ return style;
102
+ },
103
+ },
104
+ };
105
+ </script>
106
+
107
+ <style lang="scss" scoped>
108
+ .ste-loading-root {
109
+ display: inline-flex;
110
+ align-items: center;
111
+ justify-content: center;
112
+
113
+ .loading {
114
+ position: relative;
115
+ display: inline-block;
116
+ max-width: 100%;
117
+ max-height: 100%;
118
+ vertical-align: middle;
119
+
120
+ .i {
121
+ position: absolute;
122
+ top: 0;
123
+ left: 0;
124
+ width: 100%;
125
+ height: 100%;
126
+ }
127
+ .i:before {
128
+ display: block;
129
+ width: 10%;
130
+ height: 25%;
131
+ margin: 0 auto;
132
+ background-color: currentColor;
133
+ border-radius: 40%;
134
+ content: ' ';
135
+ }
136
+ }
137
+
138
+ .loading-type-1 {
139
+ animation: ste-rotate 0.8s linear infinite;
140
+ }
141
+ .loading-type-2 {
142
+ width: 100%;
143
+ height: 100%;
144
+ border-radius: 50%;
145
+ animation: ste-circular 1s linear infinite;
146
+ }
147
+
148
+ @keyframes ste-rotate {
149
+ 0% {
150
+ transform: rotate(0deg);
151
+ }
152
+ 100% {
153
+ transform: rotate(360deg);
154
+ }
155
+ }
156
+
157
+ @keyframes ste-circular {
158
+ 0% {
159
+ transform: rotate(0);
160
+ }
161
+ 100% {
162
+ transform: rotate(1turn);
163
+ }
164
+ }
165
+ }
166
+ </style>