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,293 @@
1
+ <template>
2
+ <view class="ste-radio-root" :style="[cmpStyle]" @click="click">
3
+ <view class="icon">
4
+ <slot name="icon" :slotProps="cmpSlotProps">
5
+ <view class="input-icon" :style="[cmpInputStyle]">
6
+ <ste-icon
7
+ v-if="cmpChecked && cmpIconSize"
8
+ :size="cmpIconSize * 0.8"
9
+ code="&#xe67a;"
10
+ :color="cmpDisabled ? '#bbbbbb' : '#fff'"
11
+ bold
12
+ ></ste-icon>
13
+ </view>
14
+ </slot>
15
+ </view>
16
+ <view class="text">
17
+ <slot :slotProps="cmpSlotProps"></slot>
18
+ </view>
19
+ </view>
20
+ </template>
21
+
22
+ <script>
23
+ import utils from '../../utils/utils.js';
24
+ import useColor from '../../config/color.js';
25
+ let color = useColor();
26
+ /**
27
+ * ste-radio 单选框
28
+ * @description 单选框组件,在一组备选项中进行单选。
29
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-radio
30
+ * @property {String} value 当前选中值(支持v-model双向绑定
31
+ * @property {Number|String} name 选项的值
32
+ * @property {Boolean} disabled 禁用 默认 false
33
+ * @property {Boolean} readonly 只读(不置灰) 默认 false
34
+ * @property {String} shape 形状 默认 circle
35
+ * @value circle 圆形 默认 {{String}}
36
+ * @value square 方形 {{String}}
37
+ * @property {Number|String} iconSize 图标大小,单位rpx 默认 36
38
+ * @property {String} checkedColor 选中状态的图标颜色 默认 #0090FF0
39
+ * @property {String} textPosition 文本的位置 默认 right
40
+ * @value right 右 默认 {{String}}
41
+ * @value left 左 {{String}}
42
+ * @property {Number|String} textSize 文本字体大小,单位rpx 默认 28
43
+ * @property {String} textInactiveColor 未选中的文本颜色 默认 #000000
44
+ * @property {String} textActiveColor 选中的文本颜色 默认 #000000
45
+ * @property {Boolean} textDisabled 禁用文本点击 默认 false
46
+ * @property {Number|String} marginLeft 左边距,单位rpx 默认 0
47
+ * @property {Number|String} marginRight 右边距,单位rpx 默认 0
48
+ * @property {Number|String} columnGap 单选框和文本间距,单位rpx 默认 16
49
+ * @event {Function} click 点击单选框时触发的事件
50
+ * @event {Function} change 当绑定值变化时触发的事件
51
+ */
52
+ export default {
53
+ group: '表单组件',
54
+ title: 'Radio 单选框',
55
+ name: 'ste-radio',
56
+ props: {
57
+ value: {
58
+ type: [Number, String, null],
59
+ default: '',
60
+ },
61
+ name: {
62
+ type: [Number, String, null],
63
+ default: '',
64
+ },
65
+ disabled: {
66
+ type: [Boolean, null],
67
+ default: null,
68
+ },
69
+ readonly: {
70
+ type: [Boolean, null],
71
+ default: null,
72
+ },
73
+ shape: {
74
+ type: [String, null],
75
+ default: null,
76
+ },
77
+ iconSize: {
78
+ type: [Number, String, null],
79
+ default: null,
80
+ },
81
+ checkedColor: {
82
+ type: [String, null],
83
+ default: null,
84
+ },
85
+ textPosition: {
86
+ type: [String, null],
87
+ default: null,
88
+ },
89
+ textSize: {
90
+ type: [Number, String, null],
91
+ default: null,
92
+ },
93
+ textInactiveColor: {
94
+ type: [String, null],
95
+ default: null,
96
+ },
97
+ textActiveColor: {
98
+ type: [String, null],
99
+ default: null,
100
+ },
101
+ textDisabled: {
102
+ type: [Boolean, null],
103
+ default: null,
104
+ },
105
+ marginLeft: {
106
+ type: [Number, String, null],
107
+ default: null,
108
+ },
109
+ marginRight: {
110
+ type: [Number, String, null],
111
+ default: null,
112
+ },
113
+ columnGap: {
114
+ type: [Number, String, null],
115
+ default: null,
116
+ },
117
+ },
118
+ model: {
119
+ prop: 'value',
120
+ // 派发事件名,更新父组件数据
121
+ event: 'input',
122
+ },
123
+ inject: {
124
+ radioGroup: {
125
+ default: '',
126
+ },
127
+ },
128
+ data() {
129
+ return {
130
+ clickTask: null, // click完成任务和allowStopStatus搭配使用
131
+ allowStopStatus: false, // 允许阻止后续的事件触发
132
+ };
133
+ },
134
+ computed: {
135
+ cmpDisabled() {
136
+ return this.getDefaultData('disabled', false);
137
+ },
138
+ cmpReadonly() {
139
+ return this.getDefaultData('readonly', false);
140
+ },
141
+ cmpShape() {
142
+ return this.getDefaultData('shape', 'circle');
143
+ },
144
+ cmpIconSize() {
145
+ return this.getDefaultData('iconSize', 36);
146
+ },
147
+ cmpCheckedColor() {
148
+ return this.getDefaultData('checkedColor', color.getColor().steThemeColor);
149
+ },
150
+ cmpTextPosition() {
151
+ return this.getDefaultData('textPosition', 'right');
152
+ },
153
+ cmpTextSize() {
154
+ return this.getDefaultData('textSize', 28);
155
+ },
156
+ cmpTextInactiveColor() {
157
+ return this.getDefaultData('textInactiveColor', '#000000');
158
+ },
159
+ cmpTextActiveColor() {
160
+ return this.getDefaultData('textActiveColor', '#000000');
161
+ },
162
+ cmpTextDisabled() {
163
+ return this.getDefaultData('textDisabled', false);
164
+ },
165
+ cmpMarginLeft() {
166
+ return this.getDefaultData('marginLeft', '0');
167
+ },
168
+ cmpMarginRight() {
169
+ return this.getDefaultData('marginRight', '0');
170
+ },
171
+ cmpColumnGap() {
172
+ return this.getDefaultData('columnGap', '16');
173
+ },
174
+ cmpSlotProps() {
175
+ return {
176
+ checked: this.cmpChecked,
177
+ disabled: this.cmpDisabled,
178
+ readonly: this.cmpReadonly,
179
+ };
180
+ },
181
+ cmpStyle() {
182
+ let style = {};
183
+ style['fontSize'] = utils.formatPx(this.cmpTextSize);
184
+ style['color'] = this.cmpChecked ? this.cmpTextActiveColor : this.cmpTextInactiveColor;
185
+ style['flexDirection'] = this.cmpTextPosition == 'right' ? 'row' : 'row-reverse';
186
+ style['columnGap'] = utils.formatPx(this.cmpColumnGap);
187
+ style['marginLeft'] = utils.formatPx(this.cmpMarginLeft);
188
+ style['marginRight'] = utils.formatPx(this.cmpMarginRight);
189
+ // #ifdef H5
190
+ if (this.cmpDisabled || this.cmpReadonly) {
191
+ style['cursor'] = 'not-allowed';
192
+ } else if (this.cmpTextDisabled) {
193
+ style['cursor'] = 'default';
194
+ } else {
195
+ style['cursor'] = 'pointer';
196
+ }
197
+ // #endif
198
+ if (this.cmpTextDisabled) {
199
+ style['pointerEvents'] = 'none';
200
+ }
201
+
202
+ // 在没有使用插槽内容时去掉边距
203
+ if (!this.$slots.default) {
204
+ style['columnGap'] = 0;
205
+ }
206
+
207
+ return style;
208
+ },
209
+ cmpInputStyle() {
210
+ let style = {};
211
+ // 没有icon 则默认样式
212
+ style['borderRadius'] = this.cmpShape == 'circle' ? '50%' : '0';
213
+ style['border'] = `${utils.formatPx(2)} solid ${this.cmpChecked ? this.cmpCheckedColor : '#BBBBBB'}`;
214
+ style['background'] = this.cmpChecked ? this.cmpCheckedColor : '#FFFFFF';
215
+ style['width'] = utils.formatPx(this.cmpIconSize);
216
+ style['height'] = utils.formatPx(this.cmpIconSize);
217
+ style['lineHeight'] = utils.formatPx(this.cmpIconSize);
218
+ // #ifdef H5
219
+ if (this.cmpDisabled || this.cmpReadonly) {
220
+ style['cursor'] = 'not-allowed';
221
+ } else {
222
+ style['cursor'] = 'pointer';
223
+ }
224
+ // #endif
225
+ if (this.cmpDisabled) {
226
+ style['background'] = '#eeeeee';
227
+ style['borderColor'] = '#bbbbbb';
228
+ }
229
+ return style;
230
+ },
231
+ // 选中状态
232
+ cmpChecked() {
233
+ return this.cmpGroup ? this.radioGroup.value == this.name : this.value == this.name;
234
+ },
235
+ cmpGroup() {
236
+ return !!this.radioGroup;
237
+ },
238
+ },
239
+ methods: {
240
+ async click() {
241
+ if (!this.cmpDisabled && !this.cmpReadonly) {
242
+ this.allowStopStatus = false;
243
+ this.clickTask = new Promise((resolve) => {
244
+ this.$emit('click', this.value, this.allowStop, resolve);
245
+ });
246
+ if (this.allowStopStatus) {
247
+ await this.clickTask;
248
+ }
249
+ if (!this.cmpChecked) {
250
+ let value = this.name;
251
+ if (this.cmpGroup) {
252
+ this.radioGroup.$emit('input', value);
253
+ this.radioGroup.$emit('change', value);
254
+ } else {
255
+ this.$emit('input', value);
256
+ }
257
+ this.$emit('change', value);
258
+ }
259
+ }
260
+ },
261
+ // 允许阻止后续操作
262
+ allowStop() {
263
+ this.allowStopStatus = true;
264
+ },
265
+ getDefaultData(key, value) {
266
+ return this[key] != null ? this[key] : this.radioGroup[key] ? this.radioGroup[key] : value;
267
+ },
268
+ },
269
+ };
270
+ </script>
271
+
272
+ <style lang="scss" scoped>
273
+ .ste-radio-root {
274
+ width: auto;
275
+ height: 100%;
276
+ display: flex;
277
+ column-gap: 16rpx;
278
+ align-items: center;
279
+ .input-icon {
280
+ display: flex;
281
+ justify-content: center;
282
+ align-items: flex-end;
283
+ }
284
+ .icon {
285
+ pointer-events: all;
286
+ }
287
+ .text {
288
+ display: flex;
289
+ align-items: center;
290
+ height: 100%;
291
+ }
292
+ }
293
+ </style>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <view class="ste-radio-group-root" :style="[cmpStyle]">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ /**
9
+ * ste-radio-group 单选框组
10
+ * @description 单选框组组件,内部由多个radio组成。
11
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-radio
12
+ * @property {String} value 当前选中值(支持v-model双向绑定)
13
+ * @property {String} direction 排列方式 默认 column
14
+ * @value row 横向 默认 {{String}}
15
+ * @value column 纵向 {{String}}
16
+ * @property {Boolean} disabled 禁用 默认 false
17
+ * @property {Boolean} readonly 只读(不置灰) 默认 false
18
+ * @property {String} shape 形状 默认 circle
19
+ * @value circle 圆形 默认 {{String}}
20
+ * @value square 方形 {{String}}
21
+ * @property {Number|String} iconSize 图标大小,单位rpx 默认 36
22
+ * @property {String} checkedColor 选中状态的图标颜色 默认 #0090FF0
23
+ * @property {String} textPosition 文本的位置 默认 right
24
+ * @value right 右 默认 {{String}}
25
+ * @value left 左 {{String}}
26
+ * @property {Number|String} textSize 文本字体大小,单位rpx 默认 28
27
+ * @property {String} textInactiveColor 未选中的文本颜色 默认 #000000
28
+ * @property {String} textActiveColor 选中的文本颜色 默认 #000000
29
+ * @property {Boolean} textDisabled 禁用文本点击 默认 false
30
+ * @property {Number|String} marginLeft 左边距,单位rpx 默认 0
31
+ * @property {Number|String} marginRight 右边距,单位rpx 默认 0
32
+ * @property {Number|String} columnGap 单选框和文本间距,单位rpx 默认 16
33
+ * @event {Function} change 当绑定值变化时触发的事件
34
+ */
35
+ export default {
36
+ name: 'ste-radio-group',
37
+ props: {
38
+ value: {
39
+ type: [Number, String, null],
40
+ default: '',
41
+ },
42
+ direction: {
43
+ type: [String, null],
44
+ default: 'column',
45
+ },
46
+ disabled: {
47
+ type: [Boolean, null],
48
+ default: false,
49
+ },
50
+ readonly: {
51
+ type: [Boolean, null],
52
+ default: false,
53
+ },
54
+ shape: {
55
+ type: [String, null],
56
+ default: 'circle',
57
+ },
58
+ iconSize: {
59
+ type: [Number, String, null],
60
+ default: 36,
61
+ },
62
+ checkedColor: {
63
+ type: [String, null],
64
+ default: '#0090FF',
65
+ },
66
+ textPosition: {
67
+ type: [String, null],
68
+ default: 'right',
69
+ },
70
+ textSize: {
71
+ type: [Number, String, null],
72
+ default: 28,
73
+ },
74
+ textInactiveColor: {
75
+ type: [String, null],
76
+ default: '#000000',
77
+ },
78
+ textActiveColor: {
79
+ type: [String, null],
80
+ default: '#000000',
81
+ },
82
+ textDisabled: {
83
+ type: [Boolean, null],
84
+ default: false,
85
+ },
86
+ marginLeft: {
87
+ type: [Number, String, null],
88
+ default: null,
89
+ },
90
+ marginRight: {
91
+ type: [Number, String, null],
92
+ default: null,
93
+ },
94
+ columnGap: {
95
+ type: [Number, String, null],
96
+ default: null,
97
+ },
98
+ },
99
+ model: {
100
+ prop: 'value',
101
+ // 派发事件名,更新父组件数据
102
+ event: 'input',
103
+ },
104
+ provide() {
105
+ return {
106
+ radioGroup: this,
107
+ };
108
+ },
109
+ data() {
110
+ return {};
111
+ },
112
+ computed: {
113
+ cmpStyle() {
114
+ let style = {};
115
+ style['flexDirection'] = this.direction;
116
+ return style;
117
+ },
118
+ },
119
+ };
120
+ </script>
121
+
122
+ <style lang="scss" scoped>
123
+ .ste-radio-group-root {
124
+ display: flex;
125
+ column-gap: 16rpx;
126
+ row-gap: 16rpx;
127
+ }
128
+ </style>
@@ -0,0 +1,115 @@
1
+ # Rate 徽标
2
+
3
+ 用于对事物进行评级操作。
4
+
5
+ ---$
6
+
7
+ ### 代码演示
8
+ JavaScript后面的演示代码中涉及到的变量和方法都使用本javasaript代码
9
+ ```javascript
10
+ export default {
11
+ data() {
12
+ return {
13
+ value: 2,
14
+ value1: 2,
15
+ value2: 3,
16
+ value3: 2.6,
17
+ value4: 2.5,
18
+ };
19
+ },
20
+ created() {},
21
+ methods: {
22
+ change(value) {
23
+ console.log('value', value);
24
+ },
25
+ },
26
+ };
27
+ ```
28
+ #### 基础用法
29
+ 通过`value`属性,双向绑定,设置评分的值
30
+ ```
31
+ <ste-rate v-model="value"></ste-rate>
32
+ ```
33
+ #### 自定义图标
34
+ - 通过`inactiveCode`属性,设置未选中的图标code,默认`&#xe681;`。
35
+ - 通过`activeCode`属性,设置选中的图标code,默认`&#xe684;`。
36
+ - 使用自定义code时,图标内容应该撑满盒子,避免内容距盒子距离太大,导致选中的颜色计算有偏差。
37
+ ```
38
+ <!--选中和未选中 图标一样-->
39
+ <ste-rate v-model="value1" inactiveCode="&#xe685;" activeCode="&#xe685;"></ste-rate>
40
+ <!--选中和未选中 图标不一样-->
41
+ <ste-rate v-model="value1" inactiveCode="&#xe685;" activeCode="&#xe687;"></ste-rate>
42
+ ```
43
+
44
+ #### 自定义样式
45
+ - 通过`inactiveColor`属性,设置未选中的颜色,默认`#dddddd`。
46
+ - 通过`activeColor`属性,设置选中的颜色,默认`#0090FF`。
47
+ - 通过`size`属性,设置评分图标的大小,单位`rpx`,默认`44`。
48
+ - 通过`gutter`属性,设置每个图标之间的距离,单位`rpx`,默认`10`。
49
+
50
+ ```
51
+ <ste-rate v-model="value2" inactiveColor="#F8D5D5" activeColor="#d276a3" size="80" :gutter="20"></ste-rate>
52
+ ```
53
+
54
+ #### 只读
55
+ 通过`readonly `属性,设置只读,不可切换评分,样式不置灰,可部分星, 默认`false`。
56
+ ```
57
+ <ste-rate v-model="value3" readonly></ste-rate>
58
+ ```
59
+ #### 禁用
60
+ 通过`disabled`属性,设置禁用,不可切换评分,样式置灰,可部分星,默认`false`。
61
+ ```
62
+ <ste-rate v-model="value3" disabled></ste-rate>
63
+ ```
64
+
65
+ #### 自定义数量和自定义分值
66
+ - 通过`count`属性,设置图标总数,默认`5`。
67
+ - 通过`score`属性,设置每颗图标代表的分数,默认`1`。
68
+ ```
69
+ <!--星星数量为1,分值为5, 分数为2.5-->
70
+ <ste-rate v-model="value4" :count="1" :score="5"></ste-rate>
71
+ ```
72
+
73
+ #### 自定义分值图标
74
+ - 需要传入图标code对应的数组, 此时`inactiveColor`和`activeColor`将失效
75
+ - 会根据当前评分数对应的图标数量来取`iconData`中的值为当前图标的`code`
76
+ ```
77
+ <ste-rate v-model="value5" :iconData="iconData"></ste-rate>
78
+ <script>
79
+ export default {
80
+ data() {
81
+ return {
82
+ iconData: ['&#xe686;', '', '&#xe671;', '&#xe66a;', '&#xe66b;']
83
+ }
84
+ }
85
+ }
86
+ </script>
87
+ ```
88
+
89
+ ---$
90
+ ### API
91
+ #### 组件属性(Props)
92
+
93
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
94
+ | --- | --- | --- | --- | --- | --- |
95
+ | `value` | 当前评分数(支持v-model双向绑定) | `Number` | `0` | - | - |
96
+ | `count` | 图标总数 | `Number` | `5` | - | - |
97
+ | `score` | 每颗星星代表的分数 | `Number` | `1` | - | - |
98
+ | `disabled` | 禁用 | `Boolean` | `false` | - | - |
99
+ | `readonly ` | 只读(不置灰) | `Boolean` | `false` | - | - |
100
+ | `size` | 评分图标的大小,单位`rpx` | `Number/String` | `44` | - | - |
101
+ | `inactiveColor` | 未选中的颜色 | `String` | `#dddddd` | - | - |
102
+ | `activeColor` | 选中的颜色 | `String` | `#0090FF` | - | - |
103
+ | `inactiveCode` | 未选中的图标`code` | `String` | `&#xe681;`| - | - |
104
+ | `activeCode` | 选中的图标`code` | `String` | `&#xe684;`| - | - |
105
+ | `gutter` | 每个图标之间的距离,单位`rpx` | `Number/String` | `10` | - | - |
106
+ | `iconData` | 每个分值对应的图标code | `Array` | - | - | - |
107
+
108
+
109
+ #### Events
110
+ |事件名 |说明 |事件参数 |支持版本 |
111
+ |--- |--- |--- |--- |
112
+ | `change` |当前分值变化时触发的事件 | `value`:改变后的分值 | - |
113
+
114
+ ---$
115
+ {{qinpengfei}}