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,148 @@
1
+ # Popup 弹出层
2
+
3
+ ---$
4
+
5
+ ### 代码演示
6
+ #### 基础使用
7
+ - 通过属性`show`来控制弹出层的显隐,使用`sync`修饰符来双向绑定
8
+ - 弹出位置支持上(`top`)、下(`bottom`)、左(`left`)、右(`right`)、中(`center`),默认弹出位置为中(`center`)
9
+ ```
10
+ <ste-popup :show.sync="show" width="300" height="300">
11
+ <view class="popup-content"></view>
12
+ </ste-popup>
13
+ <ste-popup :show.sync="showTop" height="300" width="100vw" position="top">
14
+ <view class="popup-content">上</view>
15
+ </ste-popup>
16
+ <ste-popup :show.sync="showBottom" height="300" width="100vw" position="bottom">
17
+ <view class="popup-content">下</view>
18
+ </ste-popup>
19
+ <ste-popup :show.sync="showLeft" width="300" height="100vh" position="left">
20
+ <view class="popup-content">左</view>
21
+ </ste-popup>
22
+ <ste-popup :show.sync="showRight" width="300" height="100vh" position="right">
23
+ <view class="popup-content">右</view>
24
+ </ste-popup>
25
+ ```
26
+
27
+ #### 背景色
28
+ ```
29
+ <ste-popup :show.sync="bgShow" width="300" height="300" backgroundColor="#eff3dd">
30
+ <view class="popup-content">背景色</view>
31
+ </ste-popup>
32
+ ```
33
+
34
+ #### 大小
35
+ - 默认弹出层的内容区域是没有高度的,如果不设置宽高则会由内容撑开
36
+ - 支持具体数值(单位为rpx)、百分比
37
+ ```
38
+ <ste-popup :show.sync="sizeShow1" width="300" height="500">
39
+ <view class="popup-content">300*500</view>
40
+ </ste-popup>
41
+ <ste-popup :show.sync="sizeShow2" width="100vw" height="300">
42
+ <view class="popup-content">100vw*300</view>
43
+ </ste-popup>
44
+ ```
45
+
46
+
47
+ #### 圆角
48
+ - 若组件圆角不满足需求,可以不设置圆角,在插槽内容中自己设置圆角
49
+ ```
50
+ <ste-popup :show.sync="roundShow" width="300" height="300" round>
51
+ <view class="popup-content">圆角</view>
52
+ </ste-popup>
53
+ ```
54
+
55
+ #### 偏移
56
+ ```
57
+ <ste-popup :show.sync="offsetShow" width="300" height="300" offsetX="50" offsetY="-50">
58
+ <view class="popup-content">偏移</view>
59
+ </ste-popup>
60
+ ```
61
+
62
+
63
+ #### 是否遮罩关闭
64
+ 默认可点击遮罩关闭弹窗
65
+ ```
66
+ <ste-popup :show.sync="maskShow1" width="300" height="300">
67
+ <view class="popup-content">遮罩可关闭</view>
68
+ </ste-popup>
69
+ <ste-popup :show.sync="maskShow2" width="300" height="300" :isMaskClick="false">
70
+ <view class="popup-content">遮罩不可关闭</view>
71
+ </ste-popup>
72
+ ```
73
+
74
+
75
+
76
+ #### 动画执行时间
77
+ ```
78
+ <ste-popup :show.sync="durationShow" width="300" height="300" :duration="800">
79
+ <view class="popup-content">动画执行时间</view>
80
+ </ste-popup>
81
+ ```
82
+
83
+ #### 异步关闭
84
+ 监听关闭事件,通过执行事件抛出的`allowStop`方法阻止关闭,等待异步操作完成后,当可关闭时再执行`resolve`方法
85
+ ```
86
+ <template>
87
+ <ste-popup :show.sync="syncShow" width="100vw" height="300" @close="syncClose" position="bottom">
88
+ <view class="popup-content">异步关闭</view>
89
+ </ste-popup>
90
+ </template>
91
+ <script>
92
+ export default {
93
+ methods: {
94
+ syncClose(allowStop, resolve) {
95
+ allowStop();
96
+ this.showToast({
97
+ title: '加载中...',
98
+ icon: 'loading',
99
+ duration: 2500,
100
+ });
101
+ setTimeout(() => {
102
+ this.hideToast();
103
+ resolve();
104
+ }, 2000);
105
+ },
106
+ }
107
+ }
108
+ </script>
109
+ ```
110
+
111
+ ---$
112
+ ### API
113
+ #### 组件属性(Props)
114
+
115
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
116
+ | --- | --- | --- | --- | --- | --- |
117
+ | `show` | 是否显示弹出层,使用`sync`修饰符来双向绑定 | `Boolean` | `false` | - | - |
118
+ | `backGround` | 内容容器的背景色 | `String` | `#ffffff` | - | - |
119
+ | `showMask` | 是否显示遮罩 | `Boolean` | `true` | - | - |
120
+ | `isMaskClick` | 是否可以点击遮罩层关闭 | `Boolean` | `true` | - | - |
121
+ | `width` | 内容区宽度 | `Number/String` | `auto` | - | - |
122
+ | `height` | 内容区高度 | `Number/String` | `auto` | - | - |
123
+ | `position` | 弹出位置 | `String` | `center` | `top` `bottom` `left` `right` | - |
124
+ | `round` | 是否圆角 | `Boolean` | `false` | - | - |
125
+ | `showClose` | 是否右上角显示关闭图标 | `Boolean` | `true` | - | - |
126
+ | `offsetX` | 根据弹出位置,设置X轴偏移量,单位px | `Number/String` | `0` | - | - |
127
+ | `offsetY` | 根据弹出位置,设置Y轴偏移量,单位px | `Number/String` | `0` | - | - |
128
+ | `duration` | 动画持续时间 | `Number` | `200` | - | - |
129
+ | `zIndex` | 弹窗层级z-index | `Number` | `1000` | - | - |
130
+ | `keepContent` | 隐藏后是否不销毁弹窗内容元素 | `Boolean` | `true` | - | `v1.10.1` |
131
+
132
+ #### 组件事件(Events)
133
+
134
+ | 事件名 | 说明 | 事件参数 |支持版本 |
135
+ |--- |--- |--- |--- |
136
+ | `close` | 关闭弹框时触发(可拦截关闭) | `value`:当前的绑定值,`alowStop`:允许阻止后续的事件触发,`resolve`:后续的事件执行 |- |
137
+ | `open-after` | 打开弹框动画结束后触发 | - | `v1.10.1` |
138
+ | `clickMask` | 点击遮罩时触发 | - |- |
139
+
140
+
141
+ #### 组件插槽(Slots)
142
+
143
+ |插槽名 |说明 |插槽参数 |支持版本 |
144
+ |--- |--- |--- |--- |
145
+ | default | 内容部分插槽 |- |- |
146
+
147
+ ---$
148
+ {{fuyuwei}}
@@ -0,0 +1,337 @@
1
+ <template>
2
+ <view
3
+ class="ste-popup"
4
+ :class="position"
5
+ :style="[cmpPageStyle]"
6
+ @click.stop="onMaskClick"
7
+ @touchmove.stop.prevent="touchmove"
8
+ :animation="overlayAnimationData"
9
+ >
10
+ <view class="content" :class="position" :style="[cmpContentStyle]" :animation="animationData" @click.stop>
11
+ <template v-if="keepContent || showContent">
12
+ <scroll-view style="width: 100%; height: 100%" v-if="height > 0" :scroll-y="true">
13
+ <slot name="default"></slot>
14
+ </scroll-view>
15
+ <slot v-else name="default"></slot>
16
+ </template>
17
+ <view class="close-icon-box" @click="close" v-if="showClose && position != 'center'">
18
+ <ste-icon code="&#xe6a0;" size="40" color="#666"></ste-icon>
19
+ </view>
20
+ </view>
21
+ <view class="close-icon-box-center" @click="close" v-if="showClose && position == 'center' && showContent">
22
+ <ste-icon code="&#xe6a0;" size="40" color="#fff"></ste-icon>
23
+ </view>
24
+ </view>
25
+ </template>
26
+ <script>
27
+ import utils from '../../utils/utils.js';
28
+ const DEFAULT_BORDER_RADIUS = 32;
29
+ /**
30
+ * ste-popup 弹出层
31
+ * @description 弹出层组件
32
+ * @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-popup
33
+ * @property {Boolean} show 是否显示弹出层,使用sync修饰符来双向绑定 默认 false
34
+ * @property {String} backgroundColor 内容容器的背景色 默认 #ffffff
35
+ * @property {Boolean} isMaskClick 是否可以点击遮罩层关闭 默认 true
36
+ * @property {Number|String} width 内容区宽度
37
+ * @property {Number|String} height 内容区高度
38
+ * @property {String} position 弹出位置 默认 center
39
+ * @value center 中 {String}
40
+ * @value top 上 {String}
41
+ * @value bottom 下 {String}
42
+ * @value left 左 {String}
43
+ * @value right 右 {String}
44
+ * @property {Boolean} round 是否圆角 默认 false
45
+ * @property {Boolean} showClose 是否右上角显示关闭图标 默认 true
46
+ * @property {Number|String} offsetX 根据弹出位置,设置X轴偏移量,单位px 默认 0
47
+ * @property {Number|String} offsetY 根据弹出位置,设置Y轴偏移量,单位px 默认 0
48
+ * @property {Number} duration 动画持续时间,单位ms
49
+ * @property {Number} zIndex 弹窗层级z-index
50
+ * @property {Boolean} keepContent 隐藏后是否不销毁弹窗内容元素 默认 true
51
+ * @event {Function} close 弹窗关闭动画执行完毕事件
52
+ * @event {Function} open 弹窗打开动画执行完毕事件
53
+ * @event {Function} maskClick 遮罩点击事件
54
+ **/
55
+ export default {
56
+ group: '基础组件',
57
+ title: 'Popup 弹出层',
58
+ name: 'ste-popup',
59
+ props: {
60
+ // 打开或者关闭弹窗,必须使用.sync进行双向绑定
61
+ show: {
62
+ type: [Boolean, null],
63
+ default: false,
64
+ },
65
+ backgroundColor: {
66
+ type: [String, null],
67
+ default: '#ffffff',
68
+ },
69
+ // 是否显示遮罩
70
+ showMask: {
71
+ type: [Boolean, null],
72
+ default: true,
73
+ },
74
+ // 蒙版点击是否关闭弹窗
75
+ isMaskClick: {
76
+ type: [Boolean, null],
77
+ default: true,
78
+ },
79
+ // 弹窗内容层宽度
80
+ width: {
81
+ type: [Number, String, null],
82
+ default: '100vw',
83
+ },
84
+ // 弹窗内容层高度
85
+ height: {
86
+ type: [Number, String, null],
87
+ default: 'auto',
88
+ },
89
+ // 位置 center top bottom left right
90
+ position: {
91
+ type: [String, null],
92
+ default: 'center',
93
+ },
94
+ round: {
95
+ type: [Boolean, null],
96
+ default: false,
97
+ },
98
+ showClose: {
99
+ type: [Boolean, null],
100
+ default: true,
101
+ },
102
+ offsetX: {
103
+ type: [Number, String, null],
104
+ default: 0,
105
+ },
106
+ offsetY: {
107
+ type: [Number, String, null],
108
+ default: 0,
109
+ },
110
+ // 动画持续时间
111
+ duration: {
112
+ type: [Number, null, null],
113
+ default: 200,
114
+ },
115
+ // 弹窗z-index
116
+ zIndex: {
117
+ type: [Number, String, null],
118
+ default: 998,
119
+ },
120
+ // 是否在动画完成后渲染或销毁内容元素
121
+ keepContent: {
122
+ type: [Boolean, null],
123
+ default: true,
124
+ },
125
+ },
126
+ data() {
127
+ return {
128
+ pageDisplay: 'none',
129
+ animationData: null,
130
+ overlayAnimationData: null,
131
+ animationProp: { duration: this.duration, timingFunction: 'ease-out' },
132
+ clickTask: null,
133
+ showContent: false, // 配合keepContent属性来渲染或销毁内容元素
134
+ };
135
+ },
136
+ created() {
137
+ if (this.show) {
138
+ this.beginAnimation();
139
+ }
140
+ },
141
+ mounted() {},
142
+ computed: {
143
+ cmpPageStyle() {
144
+ return {
145
+ zIndex: this.zIndex,
146
+ display: this.pageDisplay,
147
+ backgroundColor: this.showMask ? 'rgba(0, 0, 0, 0.6)' : 'transparent',
148
+ '--content-border-radius': utils.formatPx(this.round ? DEFAULT_BORDER_RADIUS : 0),
149
+ '--content-height': utils.addUnit(this.height / 2),
150
+ };
151
+ },
152
+ cmpContentStyle() {
153
+ let style = {
154
+ width: utils.addUnit(this.width),
155
+ height: utils.addUnit(this.height),
156
+ backgroundColor: this.backgroundColor,
157
+ };
158
+
159
+ if (this.position === 'center') {
160
+ // style.transform = `translate(${utils.addUnit(this.offsetX)}, ${utils.addUnit(this.offsetY)})`;
161
+ } else if (this.position === 'bottom') {
162
+ } else if (this.position === 'top') {
163
+ } else if (this.position === 'left') {
164
+ } else if (this.position === 'right') {
165
+ }
166
+
167
+ return style;
168
+ },
169
+ },
170
+ watch: {
171
+ show: {
172
+ handler(newVal) {
173
+ if (newVal) {
174
+ this.beginAnimation();
175
+ } else {
176
+ this.endAnimation();
177
+ }
178
+ },
179
+ },
180
+ },
181
+ methods: {
182
+ touchmove(e) {
183
+ // TODO nvue 取消冒泡
184
+ e.stopPropagation();
185
+ },
186
+ onMaskClick() {
187
+ this.$emit('clickMask');
188
+ if (this.isMaskClick) {
189
+ this.close();
190
+ }
191
+ },
192
+ // 关闭弹窗
193
+ async close() {
194
+ if (this.clickTask) {
195
+ return;
196
+ }
197
+ let next = true;
198
+ this.allowStopStatus = false;
199
+ this.clickTask = new Promise((resolve, reject) => {
200
+ this.$emit(
201
+ 'close',
202
+ () => (next = false),
203
+ () => resolve(),
204
+ () => reject()
205
+ );
206
+ });
207
+ if (!next) {
208
+ await this.clickTask;
209
+ }
210
+ this.endAnimation();
211
+ this.$emit('update:show', false);
212
+ setTimeout(() => {
213
+ this.clickTask = null;
214
+ }, this.duration);
215
+ },
216
+ allowStop() {
217
+ this.allowStopStatus = true;
218
+ },
219
+ // 打开弹窗时的动画
220
+ async beginAnimation() {
221
+ this.pageDisplay = 'flex';
222
+ await utils.sleep(50);
223
+ let animation = uni.createAnimation(this.animationProp);
224
+ let overlayAnimation = uni.createAnimation(this.animationProp);
225
+ overlayAnimation.opacity(1).step({
226
+ duration: this.duration,
227
+ });
228
+
229
+ if (this.position === 'center') {
230
+ animation.scale(1).translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
231
+ } else if (this.position === 'top' || this.position === 'bottom') {
232
+ animation.translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
233
+ } else if (this.position === 'left' || this.position === 'right') {
234
+ animation.translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
235
+ }
236
+ this.overlayAnimationData = overlayAnimation.export();
237
+ this.animationData = animation.export();
238
+
239
+ setTimeout(() => {
240
+ this.showContent = true;
241
+ this.$emit('open-after');
242
+ }, this.duration);
243
+ },
244
+ endAnimation() {
245
+ let animation = uni.createAnimation(this.animationProp);
246
+ let overlayAnimation = uni.createAnimation(this.animationProp);
247
+ overlayAnimation.opacity(0).step();
248
+
249
+ if (this.position === 'center') {
250
+ animation.scale(0).step();
251
+ } else if (this.position === 'top' || this.position === 'bottom') {
252
+ animation.translateY(this.position == 'top' ? '-100%' : '100%').step();
253
+ } else if (this.position === 'left' || this.position === 'right') {
254
+ animation.translateX(this.position == 'left' ? '-100%' : '100%').step();
255
+ }
256
+
257
+ this.overlayAnimationData = overlayAnimation.export();
258
+ this.animationData = animation.export();
259
+
260
+ setTimeout(() => {
261
+ this.pageDisplay = 'none';
262
+ this.showContent = false;
263
+ }, this.duration);
264
+ },
265
+ },
266
+ };
267
+ </script>
268
+
269
+ <style lang="scss" scoped>
270
+ .ste-popup {
271
+ height: 100vh;
272
+ width: 100vw;
273
+ overflow: hidden;
274
+ position: fixed;
275
+ left: 0;
276
+ top: 0;
277
+ overflow: hidden;
278
+ justify-content: center;
279
+ align-items: center;
280
+ touch-action: none;
281
+
282
+ .close-icon-box-center {
283
+ position: absolute;
284
+ color: #fff;
285
+ top: calc(50% + var(--content-height) + 40rpx);
286
+ left: 50%;
287
+ transform: translate(-50%, 0);
288
+ display: flex;
289
+ }
290
+ }
291
+
292
+ .content {
293
+ display: inline-block;
294
+ opacity: 1;
295
+ overflow-y: auto;
296
+ position: absolute;
297
+ .close-icon-box {
298
+ position: absolute;
299
+ right: 24rpx;
300
+ top: 24rpx;
301
+ display: flex;
302
+ }
303
+ &.center {
304
+ // position: relative;
305
+ transform: scale(0);
306
+ border-radius: var(--content-border-radius);
307
+ }
308
+ &.bottom {
309
+ transform: translateY(100%);
310
+ left: 0;
311
+ bottom: 0;
312
+ border-top-left-radius: var(--content-border-radius);
313
+ border-top-right-radius: var(--content-border-radius);
314
+ }
315
+ &.top {
316
+ transform: translateY(-100%);
317
+ left: 0;
318
+ top: 0;
319
+ border-bottom-left-radius: var(--content-border-radius);
320
+ border-bottom-right-radius: var(--content-border-radius);
321
+ }
322
+ &.left {
323
+ transform: translateX(-100%);
324
+ left: 0;
325
+ top: 0;
326
+ border-top-right-radius: var(--content-border-radius);
327
+ border-bottom-right-radius: var(--content-border-radius);
328
+ }
329
+ &.right {
330
+ transform: translateX(100%);
331
+ right: 0;
332
+ top: 0;
333
+ border-top-left-radius: var(--content-border-radius);
334
+ border-bottom-left-radius: var(--content-border-radius);
335
+ }
336
+ }
337
+ </style>
@@ -0,0 +1,129 @@
1
+ # Price 价格
2
+
3
+ 用于页面上显示价格的组件
4
+
5
+ ---$
6
+
7
+ ### 代码演示
8
+ #### 金额单位
9
+ - 默认金额单位为分,会将`value`值除以`100`
10
+ - 金额单位为元时,`valueUnit`赋值`yuan`,此时将只显示元的部分
11
+ ```html
12
+ <ste-price value="9527" />
13
+ <ste-price value="9527" valueUnit="yuan"/>
14
+ ```
15
+
16
+ #### 隐藏金额符号
17
+ - 使用`showUnit`可以控制金额符号是否显示
18
+ ```html
19
+ <ste-price value="9527" :showUnit="false" />
20
+ ```
21
+ #### 自定义金额符号
22
+ - 使用`unitSymbol`可以自定义金额符号
23
+ ```html
24
+ <ste-price value="9527" unitSymbol="$" />
25
+ ```
26
+ #### 自定义精度
27
+ - 使用`digits`可以自定义精度
28
+ ```html
29
+ <ste-price value="9520" :digits="1" />
30
+ ```
31
+
32
+ #### 金额文字尺寸
33
+ 金额文字尺寸单位为`rpx`
34
+ ```html
35
+ <ste-price value="9527" fontSize="50" />
36
+ ```
37
+
38
+ #### 金额文字颜色
39
+ ```html
40
+ <ste-price value="9527" color="green" />
41
+ ```
42
+
43
+ #### 划线价 & 划线价颜色
44
+ - 划线价颜色属性只在开启了划线价模式时才生效
45
+ ```html
46
+ <ste-price value="9527" isSuggestPrice />
47
+ <ste-price value="9527" isSuggestPrice linePriceColor="#666666" />
48
+ ```
49
+
50
+ #### 金额样式
51
+ - 当`styleType`值为`1`时,数字字号统一,
52
+ - 当数字字号<=`40rpx`,则价格符号字号为`20rpx`
53
+ - 当数字字号>`40rpx`,则价格符号字号为数字字号减`20rpx`
54
+
55
+ - 当`styleType`值为`2`时
56
+ - 当小数点前数字字号≤`28rpx` 所有部分展示字号统一
57
+ - 当`28rpx`<小数点前数字字号≤`40rpx`则其余部分字号为`20rpx`
58
+ - 当小数点前数字字号>`40rpx`则其余部分字号为小数点前数字字号减`20rpx`
59
+ - 当`styleType`值为`3`时,全部字号统一
60
+
61
+
62
+ ```html
63
+ <ste-price value="9527" :styleType="1" fontSize="20" />
64
+ <ste-price value="9527" :styleType="1" fontSize="40" />
65
+ <ste-price value="9527" :styleType="1" fontSize="60" />
66
+
67
+ <ste-price value="9527" :styleType="2" fontSize="28" />
68
+ <ste-price value="9527" :styleType="2" fontSize="40" />
69
+ <ste-price value="9527" :styleType="2" fontSize="60" />
70
+
71
+ <ste-price value="9527" :styleType="3" />
72
+ ```
73
+
74
+ #### 金额字重
75
+ - 当`bold`为`true`时,金额文本为粗体字
76
+ ```html
77
+ <ste-price value="9527" bold fontSize="50" />
78
+ ```
79
+
80
+ #### 格式化内容
81
+ ```html
82
+ <template>
83
+ <ste-price value="9527" :formatter="formatter" />
84
+ </template>
85
+ <script>
86
+ export default {
87
+ data() {
88
+ return {};
89
+ },
90
+ methods: {
91
+ formatter(price) {
92
+ // 入参是传入的value值
93
+ return (price / 100).toFixed(3);
94
+ },
95
+ },
96
+ };
97
+ </script>
98
+ ```
99
+
100
+ ---$
101
+ ### API
102
+ #### 组件属性(Props)
103
+
104
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
105
+ | --- | --- | --- | --- | --- | --- |
106
+ | `value` | 金额 | `Number/String` | `0` | - | - |
107
+ | `valueUnit` | 金额单位 用于判断传入的`value`值是`fen`还是`yuan` | `String` | `"fen"` | - | - |
108
+ | `digits` | 金额精度 | `Number` | `-1` | `-1`不处理(默认值)<br/>`0`取整<br/>`1`保留1位小数<br/>`2`保留2位小数 | `1.1.3` |
109
+ | `showUnit` | 是否显示单位符号 | `Boolean` | `true` | - | `1.1.3` |
110
+ | `unitSymbol` | 单位符号 | `String` | `"¥"` | - | `1.1.3` |
111
+ | `fontSize` | 金额文字尺寸 | `Number/String` | `30` | - | - |
112
+ | `color` | 金额文字颜色 | `String` | `"#ff1e19"` | - | - |
113
+ | `linePriceColor` | 划线价颜色 | `String` | `"#999999"` | - | - |
114
+ | `lineHeight` | 行高 :`Number`,单位rpx,`String`,同原生 | `Number/String` | `"1"` | - | - |
115
+ | `isSuggestPrice` | 是否划线价 | `Boolean` | `false` | - | - |
116
+ | `marginLeft` | 左边距 | `Number/String` | `0` | - | - |
117
+ | `marginRight` | 右边距 | `Number/String` | `0` | - | - |
118
+ | `marginTop` | 上边距 | `Number/String` | `0` | - | - |
119
+ | `marginBottom` | 下边距 | `Number/String` | `0` | - | - |
120
+ | `styleType` | 金额样式 | `Number` | `2` | `1`元和角分大小相等<br/>`2`角分小于元<br/>`3`价格符号和角,分相等 | - |
121
+ | `bold` | 金额是否加粗 | `Boolean` | `false` | - | `1.1.3` |
122
+ | `formatter` | 用来格式化内容 | `Function(value)` | - | - | - |
123
+
124
+ ---$
125
+ {{fuyuwei}}
126
+
127
+ {{xuyajun}}
128
+
129
+ {{qinpengfei}}