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,133 @@
1
+ <template>
2
+ <view class="ste-checkbox-group-root" :style="[cmpStyle]">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ /**
9
+ * ste-checkbox-group 复选框组
10
+ * @description 复选框组组件,内部由多个checkbox组成。
11
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-checkbox
12
+ * @property {Array} 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 选中状态的图标颜色 默认 #0090FF
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 {Boolean} max 最大可选数,0为无限制 默认 0
31
+ * @property {Number|String} marginLeft 左边距,单位rpx 默认 0
32
+ * @property {Number|String} marginRight 右边距,单位rpx 默认 0
33
+ * @property {Number|String} columnGap 复选框和文本间距,单位rpx 默认 16
34
+ * @event {Function} change 当绑定值变化时触发的事件
35
+ */
36
+ export default {
37
+ name: 'ste-checkbox-group',
38
+ props: {
39
+ value: {
40
+ type: [Array, null],
41
+ default: [],
42
+ },
43
+ direction: {
44
+ type: [String, null],
45
+ default: 'column',
46
+ },
47
+ disabled: {
48
+ type: [Boolean, null],
49
+ default: false,
50
+ },
51
+ readonly: {
52
+ type: [Boolean, null],
53
+ default: false,
54
+ },
55
+ shape: {
56
+ type: [String, null],
57
+ default: 'circle',
58
+ },
59
+ iconSize: {
60
+ type: [Number, String, null],
61
+ default: 36,
62
+ },
63
+ checkedColor: {
64
+ type: [String, null],
65
+ default: '',
66
+ },
67
+ textPosition: {
68
+ type: [String, null],
69
+ default: 'right',
70
+ },
71
+ textSize: {
72
+ type: [Number, String, null],
73
+ default: 28,
74
+ },
75
+ textInactiveColor: {
76
+ type: [String, null],
77
+ default: '#000000',
78
+ },
79
+ textActiveColor: {
80
+ type: [String, null],
81
+ default: '#000000',
82
+ },
83
+ textDisabled: {
84
+ type: [Boolean, null],
85
+ default: false,
86
+ },
87
+ max: {
88
+ type: [Number, null],
89
+ default: 0,
90
+ },
91
+ marginLeft: {
92
+ type: [Number, String, null],
93
+ default: null,
94
+ },
95
+ marginRight: {
96
+ type: [Number, String, null],
97
+ default: null,
98
+ },
99
+ columnGap: {
100
+ type: [Number, String, null],
101
+ default: null,
102
+ },
103
+ },
104
+ model: {
105
+ prop: 'value',
106
+ // 派发事件名,更新父组件数据
107
+ event: 'input',
108
+ },
109
+ provide() {
110
+ return {
111
+ checkboxGroup: this,
112
+ };
113
+ },
114
+ data() {
115
+ return {};
116
+ },
117
+ computed: {
118
+ cmpStyle() {
119
+ let style = {};
120
+ style['flexDirection'] = this.direction;
121
+ return style;
122
+ },
123
+ },
124
+ };
125
+ </script>
126
+
127
+ <style lang="scss" scoped>
128
+ .ste-checkbox-group-root {
129
+ display: flex;
130
+ column-gap: 16rpx;
131
+ row-gap: 16rpx;
132
+ }
133
+ </style>
@@ -0,0 +1,67 @@
1
+ # CodeInput 验证码输入
2
+ 用于验证码输入或短密码输入
3
+
4
+ ---$
5
+
6
+ ### 代码演示
7
+ #### 基础使用
8
+ ```html
9
+ <ste-code-input :maxlength="4"></ste-code-input>
10
+ <ste-code-input :maxlength="4" borderColor="rgba(0, 0, 0,0)"></ste-code-input>
11
+ ```
12
+
13
+ #### 横线模式
14
+ ```html
15
+ <ste-code-input mode="line" :maxlength="4"></ste-code-input>
16
+ ```
17
+
18
+ #### 设置长度
19
+ ```html
20
+ <ste-code-input :maxlength="5"></ste-code-input>
21
+ ```
22
+
23
+ #### 设置间距
24
+ ```html
25
+ <ste-code-input :space="0" :maxlength="4"></ste-code-input>
26
+ ```
27
+
28
+ #### 调整颜色
29
+ ```html
30
+ <ste-code-input :maxlength="4" fontColor="#f56c6c" borderColor="#f56c6c"></ste-code-input>
31
+
32
+ <ste-code-input mode="line" :maxlength="4" fontColor="#0090FF" borderColor="#0090FF"></ste-code-input>
33
+ ```
34
+
35
+ #### 自定义显示
36
+ ```html
37
+ <ste-code-input formatter="·" fontSize="100" :maxlength="4" value="1"></ste-code-input>
38
+ <ste-code-input mode="line" formatter="*" :space="0" :maxlength="4" value="12"></ste-code-input>
39
+ ```
40
+
41
+
42
+ ---$
43
+ ### API
44
+ #### Props
45
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
46
+ | --- | --- | --- | --- | --- | --- |
47
+ | `value` | 初始内容,支持双向绑定 | `Number/String` | - | - | - |
48
+ | `mode` | 输入框类型 | `String` | `box` | `box`:盒子模式<br/>`line`:底部横线模式 | - |
49
+ | `maxlength` | 最大长度 | `Number` | `6` | - | - |
50
+ | `space` | 字符间的距离 | `Number/String` | `16` | - | - |
51
+ | `fontColor` | 字体颜色 | `String` | `#000000` | - | - |
52
+ | `borderColor` | 边框和线条颜色 | `String` | `#DDDDDD` | - | - |
53
+ | `fontSize` | 字体大小 | `Number/String` | `28` | - | - |
54
+ | `size` | 输入框的大小,宽等于高 | `Number/String` | `64` | - | - |
55
+ | `formatter` | 替换输入值 | `String` | - | - | - |
56
+ | `focus` | 是否自动获取焦点 | `Boolean` | `false` | - | - |
57
+ | `disabledDot` | 是否禁止输入"."符号 | `Boolean` | `true` | - | - |
58
+ | `readOnly` | 是否只读 | `Boolean` | `false` | - | `v1.14.12`|
59
+
60
+ #### Events
61
+ |事件名 |说明 |事件参数 |支持版本 |
62
+ | --- | --- | --- |--- |
63
+ | `change` | `输入内容发生改变时触发` | `value`:当前输入的值 |- |
64
+ | `finish` | `输入字符个数达maxlength值时触发` | `value`:当前输入的值 |- |
65
+
66
+ ---$
67
+ {{fuyuwei}}
@@ -0,0 +1,302 @@
1
+ <template>
2
+ <view class="ste-code-input-root" :style="[cmpRootStyle]">
3
+ <view
4
+ class="ste-code-input-item"
5
+ :style="[getItemStyle(index)]"
6
+ v-for="(item, index) in cmpCodeLengthArray"
7
+ :key="index"
8
+ >
9
+ <text class="ste-code-input-item-dot" v-if="formatter && cmpCodeArray.length > index">
10
+ {{ formatter }}
11
+ </text>
12
+ <text class="ste-code-input-item-text" v-else>
13
+ {{ cmpCodeArray[index] || '' }}
14
+ </text>
15
+ <view class="ste-code-input-item-line" v-if="mode === 'line'"></view>
16
+ <view
17
+ v-if="isFocus && cmpCodeArray.length === index"
18
+ :style="{ backgroundColor: fontColor }"
19
+ class="ste-code-input-item-cursor"
20
+ ></view>
21
+ </view>
22
+ <input
23
+ v-if="!readOnly"
24
+ type="number"
25
+ :focus="focus"
26
+ :value="inputValue"
27
+ :maxlength="maxlength"
28
+ adjustPosition
29
+ class="ste-code-input-input"
30
+ cursor-spacing="30"
31
+ @input="inputHandler"
32
+ :style="{
33
+ height: size + 'rpx',
34
+ }"
35
+ @focus="isFocus = true"
36
+ @blur="isFocus = false"
37
+ />
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import utils from '../../utils/utils.js';
43
+ /**
44
+ * ste-code-input 验证码输入
45
+ * @description 验证码输入组件
46
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-code-input
47
+ * @property {Number|String} value 初始内容,支持双向绑定
48
+ * @property {String} mode 输入框类型
49
+ * @value box 盒子模式 {String}
50
+ * @value line 底部横线模式 {String}
51
+ * @property {Number} maxlength 最大长度
52
+ * @property {Number|String} space 字符间的距离
53
+ * @property {String} fontColor 字体颜色
54
+ * @property {String} borderColor 边框和线条颜色
55
+ * @property {Number|String} fontSize 字体大小
56
+ * @property {Number|String} size 输入框的大小,宽等于高
57
+ * @property {Number|String} formatter 替换输入值
58
+ * @property {Boolean} focus 是否自动获取焦点
59
+ * @property {Boolean} disabledDot 是否禁止输入"."符号 默认 true
60
+ * @property {Boolean} readOnly 是否只读 默认 false
61
+ * @event {Function} change 输入内容发生改变时触发
62
+ * @event {Function} finish 输入字符个数达maxlength值时触发
63
+ */
64
+ export default {
65
+ group: '表单组件',
66
+ title: 'CodeInput 验证码输入组件',
67
+ name: 'ste-code-input',
68
+ props: {
69
+ value: {
70
+ type: [String, Number, null],
71
+ default: '',
72
+ },
73
+ // 显示模式,box-盒子模式,line-底部横线模式
74
+ mode: {
75
+ type: [String, null],
76
+ default: 'box',
77
+ },
78
+ // 最大输入长度
79
+ maxlength: {
80
+ type: [String, Number, null],
81
+ default: 6,
82
+ },
83
+ // 字符间的距离
84
+ space: {
85
+ type: [String, Number, null],
86
+ default: 16,
87
+ },
88
+ // 字体颜色
89
+ fontColor: {
90
+ type: [String, null],
91
+ default: '#000000',
92
+ },
93
+ // 边框和线条颜色
94
+ borderColor: {
95
+ type: [String, null],
96
+ default: '#DDDDDD',
97
+ },
98
+ // 字体大小
99
+ fontSize: {
100
+ type: [String, Number, null],
101
+ default: 28,
102
+ },
103
+ // 输入框的大小,宽等于高
104
+ size: {
105
+ type: [String, Number, null],
106
+ default: 64,
107
+ },
108
+ // 替换输入值
109
+ formatter: {
110
+ type: [String, Number, null],
111
+ default: '',
112
+ },
113
+ // 是否自动获取焦点
114
+ focus: {
115
+ type: [Boolean, null],
116
+ default: false,
117
+ },
118
+ // 是否禁止输入"."符号
119
+ disabledDot: {
120
+ type: [Boolean, null],
121
+ default: true,
122
+ },
123
+ readOnly: {
124
+ type: [Boolean, null],
125
+ default: false,
126
+ },
127
+ },
128
+ data() {
129
+ return {
130
+ inputValue: '',
131
+ isFocus: this.focus,
132
+ };
133
+ },
134
+ watch: {
135
+ value: {
136
+ immediate: true,
137
+ handler(val) {
138
+ // 转为字符串,超出部分截掉
139
+ this.inputValue = String(val).substring(0, this.maxlength);
140
+ },
141
+ },
142
+ },
143
+ computed: {
144
+ // 根据长度,循环输入框的个数
145
+ cmpCodeLengthArray() {
146
+ return new Array(Number(this.maxlength));
147
+ },
148
+ // 将输入的值,转为数组,给item历遍时,根据当前的索引显示数组的元素
149
+ cmpCodeArray() {
150
+ return String(this.inputValue).split('');
151
+ },
152
+ cmpRootStyle() {
153
+ const style = {
154
+ '--font-size': utils.addUnit(this.fontSize),
155
+ '--font-color': this.fontColor,
156
+ '--line-width': utils.addUnit(this.size),
157
+ '--line-background-color': this.borderColor,
158
+ };
159
+ return style;
160
+ },
161
+ },
162
+ methods: {
163
+ addUnit: utils.addUnit,
164
+ // 监听输入框的值发生变化
165
+ getItemStyle(index) {
166
+ const style = {
167
+ width: utils.addUnit(this.size),
168
+ height: utils.addUnit(this.size),
169
+ };
170
+ // 盒子模式下,需要额外进行处理
171
+ if (this.mode === 'box') {
172
+ style.border = `2rpx solid ${this.borderColor}`;
173
+ style.backgroundColor = '#F5F5F5';
174
+ // 如果盒子间距为0的话
175
+ if (this.space === 0) {
176
+ // 给第一和最后一个盒子设置圆角
177
+ if (index === 0) {
178
+ style.borderTopLeftRadius = '3px';
179
+ style.borderBottomLeftRadius = '3px';
180
+ }
181
+ if (index === this.maxlength - 1) {
182
+ style.borderTopRightRadius = '3px';
183
+ style.borderBottomRightRadius = '3px';
184
+ }
185
+ // 最后一个盒子的右边框需要保留
186
+ if (index !== this.maxlength - 1) {
187
+ style.borderRight = 'none';
188
+ }
189
+ } else {
190
+ style.borderRadius = '10rpx';
191
+ }
192
+ }
193
+ if (index !== this.maxlength - 1) {
194
+ // 设置验证码字符之间的距离,通过margin-right设置,最后一个字符,无需右边框
195
+ style.marginRight = utils.addUnit(this.space);
196
+ } else {
197
+ // 最后一个盒子的有边框需要保留
198
+ style.marginRight = 0;
199
+ }
200
+
201
+ return style;
202
+ },
203
+ inputHandler(e) {
204
+ const value = e.detail.value;
205
+ this.inputValue = value;
206
+ // 是否允许输入“.”符号
207
+ if (this.disabledDot) {
208
+ this.$nextTick(() => {
209
+ this.inputValue = value.replace('.', '');
210
+ });
211
+ }
212
+ // 未达到maxlength之前,发送change事件,达到后发送finish事件
213
+ this.$emit('change', value);
214
+ // 修改通过v-model双向绑定的值
215
+ this.$emit('input', value);
216
+ // 达到用户指定输入长度时,发出完成事件
217
+ if (String(value).length >= Number(this.maxlength)) {
218
+ this.$emit('finish', value);
219
+ }
220
+ },
221
+ },
222
+ };
223
+ </script>
224
+
225
+ <style lang="scss" scoped>
226
+ .ste-code-input {
227
+ &-root {
228
+ display: inline-flex;
229
+ flex-direction: row;
230
+ position: relative;
231
+ overflow: hidden;
232
+ }
233
+ &-item {
234
+ // display: flex;
235
+ // justify-content: center;
236
+ // align-items: center;
237
+ // position: relative;
238
+ position: relative;
239
+ &-text {
240
+ font-size: var(--font-size);
241
+ color: var(--font-color);
242
+
243
+ position: absolute;
244
+ top: 50%;
245
+ left: 50%;
246
+ transform: translate(-50%, -50%);
247
+ }
248
+
249
+ &-dot {
250
+ display: inline-flex;
251
+ line-height: 1;
252
+ position: absolute;
253
+ left: 50%;
254
+ top: 50%;
255
+ transform: translate(-50%, -50%);
256
+
257
+ font-size: var(--font-size);
258
+ color: var(--font-color);
259
+ }
260
+
261
+ &-line {
262
+ position: absolute;
263
+ bottom: 0;
264
+ height: 4rpx;
265
+ border-radius: 40rpx;
266
+ width: var(--line-width);
267
+ background-color: var(--line-background-color);
268
+ }
269
+ &-cursor {
270
+ position: absolute;
271
+ top: 50%;
272
+ left: 50%;
273
+ transform: translate(-50%, -50%);
274
+ width: 2rpx;
275
+ height: 55%;
276
+ animation: 0.8s code-input-cursor-flicker infinite;
277
+ }
278
+ }
279
+
280
+ &-input {
281
+ position: absolute;
282
+ left: -100vw;
283
+ width: 200vw;
284
+ top: 0;
285
+ opacity: 0;
286
+ background-color: transparent;
287
+ text-align: left;
288
+ }
289
+
290
+ @keyframes code-input-cursor-flicker {
291
+ 0% {
292
+ opacity: 0;
293
+ }
294
+ 50% {
295
+ opacity: 1;
296
+ }
297
+ 100% {
298
+ opacity: 0;
299
+ }
300
+ }
301
+ }
302
+ </style>
@@ -0,0 +1,135 @@
1
+ # DatePicker 时间选择器
2
+ 年月日时分秒选择器
3
+
4
+ ---$
5
+
6
+ ### 代码演示
7
+ #### 基础使用
8
+ - 通过`value`属性可设置默认选中的时间(支持时间戳、字符串格式)
9
+ - 切换后的返回值为时间戳
10
+ - 没有值或值非法时显示当前时间
11
+ ```
12
+ <ste-date-picker :value="datetime" ></ste-date-picker>
13
+ ```
14
+
15
+ #### 不显示操作栏
16
+ ```
17
+ <ste-date-picker :showToolbar="false" mode="date" ></ste-date-picker>
18
+ ```
19
+
20
+ #### 时间类型
21
+ - 默认显示年、月、日、时、分、秒(`all`)
22
+ - 年月日时分(`datetime`),年月日(`date`),年月(`year-month`),月日(`month-day`),时分秒(`time`),时分(`hour-minute`),分秒(`minute-second`)
23
+ ```
24
+ <ste-date-picker mode="datetime" ></ste-date-picker>
25
+ <ste-date-picker mode="date" ></ste-date-picker>
26
+ <ste-date-picker mode="year-month" ></ste-date-picker>
27
+ <ste-date-picker mode="month-day" ></ste-date-picker>
28
+ <ste-date-picker mode="time" ></ste-date-picker>
29
+ <ste-date-picker mode="hour-minute" ></ste-date-picker>
30
+ <ste-date-picker mode="minute-second" ></ste-date-picker>
31
+ ```
32
+
33
+ #### 最大值 & 最小值
34
+ - 通过最大值最小值可设置选择的边界(支持时间戳、字符串格式)
35
+ - 可精确到秒
36
+ ```
37
+ <ste-date-picker :minDate="new Date(2000, 11, 1, 1, 0, 30, 0).getTime()" :maxDate="new Date(2030, 11, 1, 1, 23, 59, 30).getTime()" ></ste-date-picker>
38
+ <ste-date-picker maxDate="2030-01-01 00:00:00" minDate="2022-01-01 00:00:00"></ste-date-picker>
39
+ ```
40
+
41
+ #### 过滤
42
+ - 可通过`filter`属性传递一个函数来对数据进行过滤
43
+ ```
44
+ <template>
45
+ <ste-date-picker :filter="filter" mode="date" title="过滤" ></ste-date-picker>
46
+ </template>
47
+ <script>
48
+ export default {
49
+ methods: {
50
+ filter(mode, options) {
51
+ if (mode === 'year') {
52
+ return options.filter((option) => option % 5 === 0);
53
+ }
54
+ if (mode === 'month') {
55
+ return options.filter((option) => option % 4 === 0);
56
+ }
57
+ if (mode === 'day') {
58
+ return options.filter((option) => option % 2 === 0);
59
+ }
60
+
61
+ return options;
62
+ },
63
+ }
64
+ }
65
+ </script>
66
+ ```
67
+
68
+ #### 格式化
69
+ ```
70
+ <template>
71
+ <ste-date-picker :formatter="formatter" mode="date" title="格式化"></ste-date-picker>
72
+ </template>
73
+ <script>
74
+ export default {
75
+ methods: {
76
+ formatter(type, value) {
77
+ if (type === 'year') {
78
+ return `${value}年`;
79
+ }
80
+ if (type === 'month') {
81
+ return `${value}月`;
82
+ }
83
+ if (type === 'day') {
84
+ return `${value}日`;
85
+ }
86
+ return value;
87
+ },
88
+ }
89
+ }
90
+ </script>
91
+ ```
92
+
93
+ #### 选项高度
94
+ ```
95
+ <ste-date-picker mode="date" itemHeight="50" ></ste-date-picker>
96
+ ```
97
+
98
+ #### 每列可见数量
99
+ ```
100
+ <ste-date-picker mode="date" :visibleItemCount="10" ></ste-date-picker>
101
+ ```
102
+
103
+ ---$
104
+ ### API
105
+ #### Props
106
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
107
+ | --- | --- | --- | --- | --- | --- |
108
+ | `value` | 绑定值(支持时间戳、字符串格式),若是时间戳必须是`Number`格式,支持v-model双向绑定 | `Number/String` | - | - | - |
109
+ | `showToolbar` | 是否显示顶部操作栏 | `Boolean` | `true` | - | - |
110
+ | `title` | 顶部标题 | `String` | - | - | - |
111
+ | `mode` | 展示格式 | `String` | `all` | `all`:年月日时分秒 <br/>`datetime`:年月日时分<br/>`date`:年月日<br/>`year-month`:年月<br/>`month-day`:月日<br/>`datetime`:时分秒<br/>`hour-minute`:时分<br/>`minute-second`:分秒 | - |
112
+ | `maxDate` | 可选的最大时间 (支持时间戳、字符串格式),默认为当前时间后十年 | `Number/String` | - | - | - |
113
+ | `minDate` | 可选的最小时间 (支持时间戳、字符串格式),默认为当前时间前十年 | `Number/String` | - | - | - |
114
+ | `filter` | 选项过滤函数 | `Function` | - | - | - |
115
+ | `formatter` | 选项格式化函数 | `Function` | - | - | - |
116
+ | `itemHeight` | 各列中,单个选项的高度(单位px) | `Number` | `36` | - | - |
117
+ | `cancelText` | 取消按钮的文字 | `String` | `"取消"` | - | - |
118
+ | `confirmText` | 确认按钮的文字 | `String` | `"确认"` | - | - |
119
+ | `cancelColor` | 取消按钮的颜色 | `String` | `#909193` | - | - |
120
+ | `confirmColor` | 确认按钮的颜色 | `String` | `#3c9cff` | - | - |
121
+ | `visibleItemCount`| 各每列中可见选项的数量 | `Number` | `5` | - | - |
122
+
123
+
124
+ #### Events
125
+ |事件名 |说明 |事件参数 |支持版本 |
126
+ | --- | --- | --- |--- |
127
+ | `change` | 当选择值变化时触发 | `value`: 当前时间的时间戳值(毫秒) |- |
128
+ | `confirm` | 点击确定按钮 | `value`: 当前时间的时间戳值(毫秒) |- |
129
+ | `cancel` | 点击取消按钮 | - |- |
130
+
131
+
132
+
133
+
134
+ ---$
135
+ {{fuyuwei}}