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,373 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-stepper-root" :style="[cmpStyle]">
|
|
3
|
+
<ste-button v-if="theme != 'add'" :rootStyle="cmpLeftButtonStyle" @click="minus" :disabled="cmpDisableMinus">
|
|
4
|
+
<view class="button-icon">
|
|
5
|
+
<ste-icon
|
|
6
|
+
code=""
|
|
7
|
+
:size="(theme == 'card' ? cmpBtnSize : cmpBtnSize * 0.8) * 0.65"
|
|
8
|
+
:color="cmpDisableMinus ? '#cccccc' : theme == 'line' ? '#000000' : cmpMainColor"
|
|
9
|
+
:inlineBlock="false"
|
|
10
|
+
></ste-icon>
|
|
11
|
+
</view>
|
|
12
|
+
</ste-button>
|
|
13
|
+
<view v-if="theme != 'add'" class="input" :style="[cmpInputStyle]">
|
|
14
|
+
<input
|
|
15
|
+
class="input-el"
|
|
16
|
+
:type="precision ? 'digit' : 'number'"
|
|
17
|
+
:value="value"
|
|
18
|
+
@blur="blur"
|
|
19
|
+
@focus="focus"
|
|
20
|
+
:disabled="disabled || disableInput"
|
|
21
|
+
/>
|
|
22
|
+
</view>
|
|
23
|
+
<ste-button v-if="theme != 'add'" :rootStyle="cmpRightButtonStyle" @click="plus" :disabled="cmpDisablePlus">
|
|
24
|
+
<view class="button-icon">
|
|
25
|
+
<ste-icon
|
|
26
|
+
code=""
|
|
27
|
+
:size="(theme == 'card' ? cmpBtnSize : cmpBtnSize * 0.8) * 0.65"
|
|
28
|
+
:color="theme != 'line' ? '#ffffff' : theme == 'line' && cmpDisablePlus ? '#cccccc' : '#000000'"
|
|
29
|
+
:inlineBlock="false"
|
|
30
|
+
></ste-icon>
|
|
31
|
+
</view>
|
|
32
|
+
</ste-button>
|
|
33
|
+
<ste-badge
|
|
34
|
+
v-else
|
|
35
|
+
:content="value"
|
|
36
|
+
:background="background"
|
|
37
|
+
:showDot="showDot"
|
|
38
|
+
:position="position"
|
|
39
|
+
:offsetX="offsetX"
|
|
40
|
+
:offsetY="offsetY"
|
|
41
|
+
:showZero="showZero"
|
|
42
|
+
:max="badgeMax"
|
|
43
|
+
>
|
|
44
|
+
<ste-button :rootStyle="cmpRightButtonStyle" @click="plus" :disabled="cmpDisablePlus">
|
|
45
|
+
<view class="button-icon">
|
|
46
|
+
<ste-icon
|
|
47
|
+
code=""
|
|
48
|
+
:size="(theme == 'card' ? cmpBtnSize : cmpBtnSize * 0.8) * 0.65"
|
|
49
|
+
:color="theme != 'line' ? '#ffffff' : theme == 'line' && cmpDisablePlus ? '#cccccc' : '#000000'"
|
|
50
|
+
:inlineBlock="false"
|
|
51
|
+
></ste-icon>
|
|
52
|
+
</view>
|
|
53
|
+
</ste-button>
|
|
54
|
+
</ste-badge>
|
|
55
|
+
</view>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
import utils from '../../utils/utils.js';
|
|
60
|
+
import useColor from '../../config/color.js';
|
|
61
|
+
let color = useColor();
|
|
62
|
+
/**
|
|
63
|
+
* ste-stepper 步进器
|
|
64
|
+
* @description 步进器组件,步进器由增加按钮、减少按钮和输入框组成,用于在一定范围内输入、调整数字。
|
|
65
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-stepper
|
|
66
|
+
* @property {Number} value 当前输入的值,支持双向绑定 默认 1
|
|
67
|
+
* @property {Number} min 最小值 默认 0
|
|
68
|
+
* @property {Number} max 最大值 默认 Infinity
|
|
69
|
+
* @property {Number} step 步长,每次加或减的值 默认 1
|
|
70
|
+
* @property {Number|String} inputWidth 输入框宽度,默认单位为rpx 默认 64
|
|
71
|
+
* @property {Number|String} btnSize 按钮大小以及输入框高度,默认单位为rpx 默认 48
|
|
72
|
+
* @property {Number} precision 数值精度 默认 0
|
|
73
|
+
* @property {String} theme 样式风格 默认 card
|
|
74
|
+
* @value card 面型 {String}
|
|
75
|
+
* @value line 线型 {String}
|
|
76
|
+
* @value add 纯加购按钮 {String}
|
|
77
|
+
* @property {String} mainColor 主色 默认 #0090FF
|
|
78
|
+
* @property {Boolean} disabled 是否禁用步进器 默认 false
|
|
79
|
+
* @property {Boolean} disablePlus 是否禁用增加按钮 默认 false
|
|
80
|
+
* @property {Boolean} disableMinus 是否禁用减少按钮 默认 false
|
|
81
|
+
* @property {Boolean} disableInput 是否禁用输入框 默认 false
|
|
82
|
+
* @property {String} background 背景 默认 #ee0a24
|
|
83
|
+
* @property {Boolean} showDot 是否展示为小红点 默认 false
|
|
84
|
+
* @property {Number|String} offsetX 根据徽标位置,设置x轴偏移量 默认 auto
|
|
85
|
+
* @property {Number|String} offsetY 根据徽标位置,设置y轴偏移量 默认 auto
|
|
86
|
+
* @property {Boolean} showZero 当 content 为数字 0,是否展示徽标,默认 false
|
|
87
|
+
* @property {String} position 徽标位置 默认 topRight
|
|
88
|
+
* @value topRight 上右 {String}
|
|
89
|
+
* @value topLeft 上左 {String}
|
|
90
|
+
* @value bottomLeft 下左 {String}
|
|
91
|
+
* @value bottomRight 下右 {String}
|
|
92
|
+
* @property {Number} badgeMax 徽标最大显示值 默认 99
|
|
93
|
+
* @event {Function} change 当绑定值变化时触发的事件 `value`:改变后的绑定值
|
|
94
|
+
* @event {Function} plus 点击增加按钮时触发(可拦截change事件)`value`:改变后的绑定值,`allowStop`:允许阻止后续的事件触发,:`resolve`:后续的事件执行
|
|
95
|
+
* @event {Function} minus 点击减少按钮时触发(可拦截change事件)`value`:改变后的绑定值,`allowStop`:允许阻止后续的事件触发,:`resolve`:后续的事件执行
|
|
96
|
+
* @event {Function} focus 输入框聚焦时触发
|
|
97
|
+
* @event {Function} blur 输入框失焦时触发
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
group: '表单组件',
|
|
102
|
+
title: 'Stepper 步进器',
|
|
103
|
+
name: 'ste-stepper',
|
|
104
|
+
props: {
|
|
105
|
+
value: {
|
|
106
|
+
type: [Number, null],
|
|
107
|
+
default: 1,
|
|
108
|
+
},
|
|
109
|
+
min: {
|
|
110
|
+
type: [Number, null],
|
|
111
|
+
default: 0,
|
|
112
|
+
},
|
|
113
|
+
max: {
|
|
114
|
+
type: [Number, null],
|
|
115
|
+
default: Infinity,
|
|
116
|
+
},
|
|
117
|
+
step: {
|
|
118
|
+
type: [Number, null],
|
|
119
|
+
default: 1,
|
|
120
|
+
},
|
|
121
|
+
inputWidth: {
|
|
122
|
+
type: [Number, String, null],
|
|
123
|
+
default: 64,
|
|
124
|
+
},
|
|
125
|
+
btnSize: {
|
|
126
|
+
type: [Number, String, null],
|
|
127
|
+
default: null,
|
|
128
|
+
},
|
|
129
|
+
precision: {
|
|
130
|
+
type: [Number, null],
|
|
131
|
+
default: 0,
|
|
132
|
+
},
|
|
133
|
+
theme: {
|
|
134
|
+
type: [String, null],
|
|
135
|
+
default: 'card',
|
|
136
|
+
},
|
|
137
|
+
mainColor: {
|
|
138
|
+
type: [String, null],
|
|
139
|
+
default: '',
|
|
140
|
+
},
|
|
141
|
+
disabled: {
|
|
142
|
+
type: [Boolean, null],
|
|
143
|
+
default: false,
|
|
144
|
+
},
|
|
145
|
+
disablePlus: {
|
|
146
|
+
type: [Boolean, null],
|
|
147
|
+
default: false,
|
|
148
|
+
},
|
|
149
|
+
disableMinus: {
|
|
150
|
+
type: [Boolean, null],
|
|
151
|
+
default: false,
|
|
152
|
+
},
|
|
153
|
+
disableInput: {
|
|
154
|
+
type: [Boolean, null],
|
|
155
|
+
default: false,
|
|
156
|
+
},
|
|
157
|
+
background: {
|
|
158
|
+
type: [String, null],
|
|
159
|
+
default: '#ee0a24',
|
|
160
|
+
},
|
|
161
|
+
showDot: {
|
|
162
|
+
type: [Boolean, null],
|
|
163
|
+
default: false,
|
|
164
|
+
},
|
|
165
|
+
offsetX: {
|
|
166
|
+
type: [String, Number, null],
|
|
167
|
+
default: 'auto',
|
|
168
|
+
},
|
|
169
|
+
offsetY: {
|
|
170
|
+
type: [String, Number, null],
|
|
171
|
+
default: 'auto',
|
|
172
|
+
},
|
|
173
|
+
showZero: {
|
|
174
|
+
type: [Boolean, null],
|
|
175
|
+
default: false,
|
|
176
|
+
},
|
|
177
|
+
position: {
|
|
178
|
+
type: [String, null],
|
|
179
|
+
default: 'topRight',
|
|
180
|
+
},
|
|
181
|
+
badgeMax: {
|
|
182
|
+
type: [Number, null],
|
|
183
|
+
default: 99,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
model: {
|
|
187
|
+
prop: 'value',
|
|
188
|
+
// 派发事件名,更新父组件数据
|
|
189
|
+
event: 'input',
|
|
190
|
+
},
|
|
191
|
+
data() {
|
|
192
|
+
return {
|
|
193
|
+
clickTask: null, // click完成任务和allowStopStatus搭配使用
|
|
194
|
+
allowStopStatus: false, // 允许阻止后续的事件触发
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
created() {},
|
|
198
|
+
computed: {
|
|
199
|
+
cmpButtonStyle() {
|
|
200
|
+
let style = {};
|
|
201
|
+
style['width'] = utils.formatPx(this.cmpBtnSize);
|
|
202
|
+
style['height'] = utils.formatPx(this.theme == 'card' ? this.cmpBtnSize : this.cmpBtnSize * 0.8);
|
|
203
|
+
style['padding'] = '0';
|
|
204
|
+
// #ifdef H5
|
|
205
|
+
style['cursor'] = this.disabled || this.cmpDisablePlus ? 'not-allowed' : 'pointer';
|
|
206
|
+
// #endif
|
|
207
|
+
style['borderRadius'] = utils.formatPx(16);
|
|
208
|
+
style['border'] = 'none';
|
|
209
|
+
if (this.theme == 'line') {
|
|
210
|
+
style['borderRadius'] = '0';
|
|
211
|
+
}
|
|
212
|
+
return style;
|
|
213
|
+
},
|
|
214
|
+
cmpLeftButtonStyle() {
|
|
215
|
+
let style = {};
|
|
216
|
+
if (this.theme == 'card') {
|
|
217
|
+
style['border'] = `${utils.formatPx('2')} solid ${
|
|
218
|
+
(this.cmpDisableMinus ? '#cccccc' : this.cmpMainColor) + '80'
|
|
219
|
+
}`;
|
|
220
|
+
}
|
|
221
|
+
if (this.theme == 'line') {
|
|
222
|
+
style['border'] = `none`;
|
|
223
|
+
}
|
|
224
|
+
style['background'] = '#ffffff';
|
|
225
|
+
style['backgroundColor'] = '#ffffff';
|
|
226
|
+
// #ifdef H5
|
|
227
|
+
style['cursor'] = this.cmpDisableMinus ? 'not-allowed' : 'pointer';
|
|
228
|
+
// #endif
|
|
229
|
+
return utils.deepMerge(utils.deepClone(this.cmpButtonStyle), style);
|
|
230
|
+
},
|
|
231
|
+
cmpRightButtonStyle() {
|
|
232
|
+
let style = {};
|
|
233
|
+
style['background'] = this.cmpDisablePlus ? '#cccccc' : this.cmpMainColor;
|
|
234
|
+
style['backgroundColor'] = this.cmpDisablePlus ? '#cccccc' : this.cmpMainColor;
|
|
235
|
+
if (this.theme == 'line') {
|
|
236
|
+
style['background'] = '#ffffff';
|
|
237
|
+
style['backgroundColor'] = '#ffffff';
|
|
238
|
+
}
|
|
239
|
+
return utils.deepMerge(utils.deepClone(this.cmpButtonStyle), style);
|
|
240
|
+
},
|
|
241
|
+
cmpInputStyle() {
|
|
242
|
+
let style = {};
|
|
243
|
+
style['width'] = utils.formatPx(this.inputWidth);
|
|
244
|
+
style['height'] = utils.formatPx(this.theme == 'card' ? this.cmpBtnSize : this.cmpBtnSize * 0.8);
|
|
245
|
+
style['margin'] = `0 ${utils.formatPx(4)}`;
|
|
246
|
+
style['color'] = this.disabled || this.disableInput ? '#cccccc' : '#000000';
|
|
247
|
+
// #ifdef H5
|
|
248
|
+
style['cursor'] = this.disabled || this.cmpDisablePlus ? 'not-allowed' : 'pointer';
|
|
249
|
+
// #endif
|
|
250
|
+
if (this.theme == 'line') {
|
|
251
|
+
style['borderLeft'] = `${utils.formatPx('2')} solid #EEEEEE`;
|
|
252
|
+
style['borderRight'] = `${utils.formatPx('2')} solid #EEEEEE`;
|
|
253
|
+
style['margin'] = `0`;
|
|
254
|
+
style['padding'] = `0 ${utils.formatPx(8)}`;
|
|
255
|
+
style['width'] = utils.formatPx(this.inputWidth + 16);
|
|
256
|
+
}
|
|
257
|
+
return style;
|
|
258
|
+
},
|
|
259
|
+
cmpDisablePlus() {
|
|
260
|
+
if (this.disabled || this.disablePlus) {
|
|
261
|
+
return true;
|
|
262
|
+
} else {
|
|
263
|
+
return this.value >= this.max;
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
cmpDisableMinus() {
|
|
267
|
+
if (this.disabled || this.disableMinus) {
|
|
268
|
+
return true;
|
|
269
|
+
} else {
|
|
270
|
+
return this.value <= this.min;
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
cmpStyle() {
|
|
274
|
+
let style = {};
|
|
275
|
+
if (this.theme == 'line') {
|
|
276
|
+
style['border'] = `${utils.formatPx('0.6')} solid #EEEEEE`;
|
|
277
|
+
style['height'] = utils.formatPx(this.theme == 'card' ? this.cmpBtnSize : this.cmpBtnSize * 0.8);
|
|
278
|
+
style['borderRadius'] = utils.formatPx(24);
|
|
279
|
+
style['overflow'] = 'hidden';
|
|
280
|
+
}
|
|
281
|
+
return style;
|
|
282
|
+
},
|
|
283
|
+
cmpBtnSize() {
|
|
284
|
+
return this.btnSize ? this.btnSize : this.theme == 'card' ? 48 : 60;
|
|
285
|
+
},
|
|
286
|
+
cmpMainColor() {
|
|
287
|
+
return this.mainColor ? this.mainColor : color.getColor().steThemeColor;
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
methods: {
|
|
291
|
+
handleValue(value) {
|
|
292
|
+
// 处理最大和最小值
|
|
293
|
+
if (value <= this.min) {
|
|
294
|
+
value = this.min;
|
|
295
|
+
}
|
|
296
|
+
if (value >= this.max) {
|
|
297
|
+
value = this.max;
|
|
298
|
+
}
|
|
299
|
+
return Number(Number(value).toFixed(this.precision));
|
|
300
|
+
},
|
|
301
|
+
blur(event) {
|
|
302
|
+
let { value } = event.detail ?? 0;
|
|
303
|
+
// 解决实际值没有变化 显示值不刷新的问题
|
|
304
|
+
this.$emit('input', value);
|
|
305
|
+
value = this.handleValue(value);
|
|
306
|
+
this.$nextTick(() => {
|
|
307
|
+
this.$emit('input', value);
|
|
308
|
+
event.detail.value = value;
|
|
309
|
+
this.$emit('blur', event);
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
focus(event) {
|
|
313
|
+
this.$emit('focus', event);
|
|
314
|
+
},
|
|
315
|
+
async plus() {
|
|
316
|
+
if (!this.disabled && !this.cmpDisablePlus) {
|
|
317
|
+
this.allowStopStatus = false;
|
|
318
|
+
this.clickTask = null;
|
|
319
|
+
this.clickTask = new Promise((resolve) => {
|
|
320
|
+
this.$emit('plus', this.value, this.allowStop, resolve);
|
|
321
|
+
});
|
|
322
|
+
if (this.allowStopStatus) {
|
|
323
|
+
await this.clickTask;
|
|
324
|
+
}
|
|
325
|
+
let value = this.handleValue(this.value + this.step);
|
|
326
|
+
this.$emit('input', value);
|
|
327
|
+
this.$emit('change', value);
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
async minus() {
|
|
331
|
+
if (!this.disabled && !this.cmpDisableMinus) {
|
|
332
|
+
this.allowStopStatus = false;
|
|
333
|
+
this.clickTask = null;
|
|
334
|
+
this.clickTask = new Promise((resolve) => {
|
|
335
|
+
this.$emit('minus', this.value, this.allowStop, resolve);
|
|
336
|
+
});
|
|
337
|
+
if (this.allowStopStatus) {
|
|
338
|
+
await this.clickTask;
|
|
339
|
+
}
|
|
340
|
+
let value = this.handleValue(this.value - this.step);
|
|
341
|
+
this.$emit('input', value);
|
|
342
|
+
this.$emit('change', value);
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
// 允许阻止后续操作
|
|
346
|
+
allowStop() {
|
|
347
|
+
this.allowStopStatus = true;
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
</script>
|
|
352
|
+
|
|
353
|
+
<style lang="scss" scoped>
|
|
354
|
+
.ste-stepper-root {
|
|
355
|
+
display: flex;
|
|
356
|
+
|
|
357
|
+
.input {
|
|
358
|
+
font-weight: bold;
|
|
359
|
+
color: #000000;
|
|
360
|
+
text-align: center;
|
|
361
|
+
.input-el {
|
|
362
|
+
height: 100%;
|
|
363
|
+
font-size: 28rpx;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.button-icon {
|
|
368
|
+
display: flex;
|
|
369
|
+
justify-content: center;
|
|
370
|
+
align-items: center;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
</style>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Steps 步骤条
|
|
2
|
+
|
|
3
|
+
步骤条组件,拆分展示某项流程的步骤,引导用户按流程完成任务或向用户展示当前状态。
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 代码演示
|
|
8
|
+
JavaScript后面的演示代码中涉及到的变量和方法都使用本javasaript代码
|
|
9
|
+
```
|
|
10
|
+
export default {
|
|
11
|
+
data() {
|
|
12
|
+
return {
|
|
13
|
+
active: 0,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
goToNext() {
|
|
18
|
+
this.active++;
|
|
19
|
+
},
|
|
20
|
+
toToast(index) {
|
|
21
|
+
this.showToast({
|
|
22
|
+
title: `进度:${index}`,
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 基础用法
|
|
30
|
+
`active` 为步骤进度,为 `Number` 类型,步骤的下标。
|
|
31
|
+
```
|
|
32
|
+
<ste-steps :active="active" @clickStep="toToast">
|
|
33
|
+
<ste-step></ste-step>
|
|
34
|
+
<ste-step></ste-step>
|
|
35
|
+
<ste-step></ste-step>
|
|
36
|
+
</ste-steps>
|
|
37
|
+
```
|
|
38
|
+
### 设置标题和描述信息
|
|
39
|
+
可以通过 `title` 和 `description` 设置步骤的标题和描述信息。如果不设置标题,则会使用默认的文案。
|
|
40
|
+
```
|
|
41
|
+
<ste-steps :active="active">
|
|
42
|
+
<ste-step title="步骤1" description="注册1个账号"></ste-step>
|
|
43
|
+
<ste-step title="步骤2" description="登录账号并绑定手机"></ste-step>
|
|
44
|
+
<ste-step title="步骤3" description="完善个人信息"></ste-step>
|
|
45
|
+
</ste-steps>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 修改图标
|
|
49
|
+
- 可以通过 `icon` 属性设置步骤的图标,传入图标的名称,也可以通过 `icon` 的 slot 插槽自定义图标
|
|
50
|
+
- 优先级:插槽 > 点状 > icon属性 > 默认图标
|
|
51
|
+
```
|
|
52
|
+
<ste-steps :active="active">
|
|
53
|
+
<ste-step></ste-step>
|
|
54
|
+
<ste-step icon=""></ste-step>
|
|
55
|
+
<ste-step>
|
|
56
|
+
<template v-slot:icon>
|
|
57
|
+
<ste-icon class="ste-step-icon-inner" code="" :size="40" color="red"></ste-icon>
|
|
58
|
+
</template>
|
|
59
|
+
</ste-step>
|
|
60
|
+
</ste-steps>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 竖向步骤条
|
|
64
|
+
可以通过 `direction` 属性设置步骤条方向,`row`:横向,`column`:竖向,默认为`row`
|
|
65
|
+
```
|
|
66
|
+
<view class="item-block" style="height: 600rpx; padding: 30rpx 60rpx">
|
|
67
|
+
<ste-steps :active="active" direction="column">
|
|
68
|
+
<ste-step description="注册1个账号"></ste-step>
|
|
69
|
+
<ste-step description="登录账号并绑定手机"></ste-step>
|
|
70
|
+
<ste-step description="完善个人信息"></ste-step>
|
|
71
|
+
</ste-steps>
|
|
72
|
+
</view>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 点状步骤和垂直方向
|
|
76
|
+
可以通过 `dot` 属性设置点状步骤条
|
|
77
|
+
```
|
|
78
|
+
<view class="item-block" style="height: 600rpx; padding: 30rpx 60rpx">
|
|
79
|
+
<ste-steps :active="active" dot direction="column">
|
|
80
|
+
<ste-step></ste-step>
|
|
81
|
+
<ste-step></ste-step>
|
|
82
|
+
<ste-step></ste-step>
|
|
83
|
+
</ste-steps>
|
|
84
|
+
</view>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 修改状态
|
|
88
|
+
设置 `status`,支持 `finished`(完成)、`process`(进行中)、`error`(失败) 三种状态。
|
|
89
|
+
```
|
|
90
|
+
<ste-steps :active="active">
|
|
91
|
+
<ste-step title="绑定手机" status="error"></ste-step>
|
|
92
|
+
<ste-step title="重新绑定手机"></ste-step>
|
|
93
|
+
<ste-step title="步骤3"></ste-step>
|
|
94
|
+
</ste-steps>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---$
|
|
98
|
+
### API
|
|
99
|
+
#### Steps组件属性(Props)
|
|
100
|
+
|
|
101
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
102
|
+
| --- | --- | --- | --- | --- | --- |
|
|
103
|
+
| `active` | 步骤进度 | `Number` | `0` | - | - |
|
|
104
|
+
| `direction` | 步骤条方向 | `String` | `row` | `row`:横向 <br/>`column`:竖向 | - |
|
|
105
|
+
| `dot` | 点状步骤条 | `Boolean` | `false` | - | - |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
#### Steps Events
|
|
109
|
+
|
|
110
|
+
|事件名 |说明 |事件参数 |支持版本 |
|
|
111
|
+
|--- |--- |--- |--- |
|
|
112
|
+
| `clickStep` |点击步骤的标题或图标时触发 | `index`: 点击的步骤序号 | - |
|
|
113
|
+
|
|
114
|
+
#### Step组件属性(Props)
|
|
115
|
+
|
|
116
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
117
|
+
| --- | --- | --- | --- | --- | --- |
|
|
118
|
+
| `title` | 流程步骤的标题 | `String` | - | - | - |
|
|
119
|
+
| `description` | 流程步骤的描述性文字(支持 html 结构) | `String` | - | - | - |
|
|
120
|
+
| `icon` | 图标 | `String` | - | - | - |
|
|
121
|
+
| `status` | 步骤状态 | `String` | - | - | - |
|
|
122
|
+
|
|
123
|
+
#### Step Slots
|
|
124
|
+
|
|
125
|
+
|插槽名 |说明 |插槽参数 |支持版本 |
|
|
126
|
+
|--- |--- |--- |--- |
|
|
127
|
+
|`title` |步骤标题 |- |- |
|
|
128
|
+
|`content` |步骤内容 |- |- |
|
|
129
|
+
|`icon` |步骤图标 |- |- |
|
|
130
|
+
|
|
131
|
+
---$
|
|
132
|
+
{{qinpengfei}}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-steps-root" :class="[`ste-steps-${direction}`]">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import utils from '../../utils/utils.js';
|
|
9
|
+
/**
|
|
10
|
+
* ste-steps 步骤条
|
|
11
|
+
* @description 步骤条组件,拆分展示某项流程的步骤,引导用户按流程完成任务或向用户展示当前状态。。
|
|
12
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-steps
|
|
13
|
+
* @property {Number} active 步骤进度默认 0
|
|
14
|
+
* @property {Boolean} direction 步骤条方向 默认 row
|
|
15
|
+
* @value row 横向 {{String}}
|
|
16
|
+
* @value column 竖向 {{String}}
|
|
17
|
+
* @property {Boolean} dot 点状步骤条 默认 false
|
|
18
|
+
* @event {Function} clickStep 点击步骤的标题或图标时触发
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
group: '展示组件',
|
|
23
|
+
title: 'Steps 步骤条',
|
|
24
|
+
name: 'steps',
|
|
25
|
+
options: {
|
|
26
|
+
virtualHost: true,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
active: {
|
|
30
|
+
type: [Number, null],
|
|
31
|
+
default: 0,
|
|
32
|
+
},
|
|
33
|
+
direction: {
|
|
34
|
+
type: [String, null],
|
|
35
|
+
default: 'row',
|
|
36
|
+
},
|
|
37
|
+
dot: {
|
|
38
|
+
type: [Boolean, null],
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
provide() {
|
|
43
|
+
return {
|
|
44
|
+
steps: this,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
.ste-steps-root {
|
|
52
|
+
display: flex;
|
|
53
|
+
width: 100%;
|
|
54
|
+
flex: 1;
|
|
55
|
+
}
|
|
56
|
+
.ste-steps-column {
|
|
57
|
+
flex-flow: column;
|
|
58
|
+
height: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ste-steps-row {
|
|
62
|
+
flex-direction: row;
|
|
63
|
+
flex: 1;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Sticky 吸顶
|
|
2
|
+
- 吸顶组件
|
|
3
|
+
|
|
4
|
+
---$
|
|
5
|
+
|
|
6
|
+
### 代码演示
|
|
7
|
+
|
|
8
|
+
#### 基础用法
|
|
9
|
+
- 事件`fixed`监听组件进入粘性布局时触发
|
|
10
|
+
- 事件`unfixed`监听组件取消粘性布局时触发
|
|
11
|
+
```html
|
|
12
|
+
<ste-sticky @fixed="onFixed" @unfixed="onUnfixed">
|
|
13
|
+
<ste-button :round="false">粘性布局的按钮</ste-button>
|
|
14
|
+
</ste-sticky>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default{
|
|
18
|
+
methods: {
|
|
19
|
+
onFixed() {
|
|
20
|
+
console.log('吸顶状态时触发');
|
|
21
|
+
},
|
|
22
|
+
onUnfixed() {
|
|
23
|
+
console.log('非吸顶状态时触发');
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
---$
|
|
33
|
+
### API
|
|
34
|
+
#### Swiper Props
|
|
35
|
+
|
|
36
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
37
|
+
| ----- | ----- | ----- | ----- | ----- | ----- |
|
|
38
|
+
| `offsetTop` | 吸顶时与顶部的距离,单位rpx(默认 0 ) | `Number`,`String` | `0` | - | - |
|
|
39
|
+
| `customNavHeight` | 航栏的高度,单位rpx(没有导航栏时,请设置为0) | `Number`,`String` | H5时为`44`<br/>小程序时根据胶囊位置自动计算 | - | - |
|
|
40
|
+
| `disabled` | 是否禁用 | `Boolean` | `false` | - | - |
|
|
41
|
+
| `background` | 组件背景,默认 | `String` | `#FFF` | - | - |
|
|
42
|
+
| `zIndex` | 吸顶时的z-index值 | `Number` | `98` | - | - |
|
|
43
|
+
|
|
44
|
+
#### Swiper Events
|
|
45
|
+
|事件名 |说明 |事件参数 |支持版本 |
|
|
46
|
+
| --- | --- | --- | --- |
|
|
47
|
+
| `fixed` | 吸顶状态时触发 | - | - |
|
|
48
|
+
| `unfixed` | 非吸顶状态时触发 | - | - |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
---$
|
|
52
|
+
{{xuyajun}}
|