stellar-ui-v2 1.40.21 → 1.40.22

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.
@@ -7,396 +7,396 @@
7
7
  @click.stop="onMaskClick"
8
8
  :animation="overlayAnimationData"
9
9
  >
10
- <!-- #endif -->
11
- <!-- #ifdef H5 || APP-PLUS -->
12
- <view
13
- class="ste-popup"
14
- :class="'ste-popup-' + _uid"
15
- :style="[cmpPageStyle]"
16
- @click.stop="onMaskClick"
17
- :animation="overlayAnimationData"
18
- :prop-show="show"
19
- :prop-appendToBody="appendToBody"
20
- :change:prop-show="() => {}"
21
- :change:prop-appendToBody="() => {}"
22
- >
23
- <!-- #endif -->
24
- <view class="content" :class="position" :style="[cmpContentStyle]" :animation="animationData" @click.stop>
25
- <template v-if="keepContent || showContent">
26
- <scroll-view style="width: 100%; height: 100%" v-if="height > 0" :scroll-y="true" @touchmove.stop.prevent="touchmove">
27
- <slot name="default"></slot>
28
- </scroll-view>
29
- <slot v-else name="default"></slot>
30
- </template>
31
- <view class="close-icon-box" @click="close" v-if="showClose && position != 'center'">
32
- <ste-icon code="&#xe6a0;" size="40" color="#666"></ste-icon>
33
- </view>
34
- </view>
35
- <view class="close-icon-box-center" @click="close" v-if="showClose && position == 'center' && showContent">
36
- <ste-icon code="&#xe6a0;" size="40" color="#fff"></ste-icon>
37
- </view>
38
- </view>
39
- </template>
40
- <script>
41
- import utils from '../../utils/utils.js';
42
- const DEFAULT_BORDER_RADIUS = 32;
43
- /**
44
- * ste-popup 弹出层
45
- * @description 弹出层组件
46
- * @tutorial https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui&menu=%E7%BB%84%E4%BB%B6&active=ste-popup
47
- * @property {Boolean} show 是否显示弹出层,使用sync修饰符来双向绑定 默认 false
48
- * @property {String} backgroundColor 内容容器的背景色 默认 #ffffff
49
- * @property {Boolean} isMaskClick 是否可以点击遮罩层关闭 默认 true
50
- * @property {Number|String} width 内容区宽度
51
- * @property {Number|String} height 内容区高度
52
- * @property {String} position 弹出位置 默认 center
53
- * @value center 中 {String}
54
- * @value top 上 {String}
55
- * @value bottom 下 {String}
56
- * @value left 左 {String}
57
- * @value right 右 {String}
58
- * @property {Boolean} round 是否圆角 默认 false
59
- * @property {Boolean} showClose 是否右上角显示关闭图标 默认 true
60
- * @property {Number|String} offsetX 根据弹出位置,设置X轴偏移量,单位px 默认 0
61
- * @property {Number|String} offsetY 根据弹出位置,设置Y轴偏移量,单位px 默认 0
62
- * @property {Number} duration 动画持续时间,单位ms
63
- * @property {Number} zIndex 弹窗层级z-index
10
+ <!-- #endif -->
11
+ <!-- #ifdef H5 || APP-PLUS -->
12
+ <view
13
+ class="ste-popup"
14
+ :class="'ste-popup-' + _uid"
15
+ :style="[cmpPageStyle]"
16
+ @click.stop="onMaskClick"
17
+ :animation="overlayAnimationData"
18
+ :prop-show="show"
19
+ :prop-appendToBody="appendToBody"
20
+ :change:prop-show="() => {}"
21
+ :change:prop-appendToBody="() => {}"
22
+ >
23
+ <!-- #endif -->
24
+ <view class="content" :class="position" :style="[cmpContentStyle]" :animation="animationData" @click.stop>
25
+ <template v-if="keepContent || showContent">
26
+ <scroll-view style="width: 100%; height: 100%" v-if="height > 0" :scroll-y="true" @touchmove.stop.prevent="touchmove">
27
+ <slot name="default"></slot>
28
+ </scroll-view>
29
+ <slot v-else name="default"></slot>
30
+ </template>
31
+ <view class="close-icon-box" @click="close" v-if="showClose && position != 'center'">
32
+ <ste-icon code="&#xe6a0;" size="40" color="#666"></ste-icon>
33
+ </view>
34
+ </view>
35
+ <view class="close-icon-box-center" @click="close" v-if="showClose && position == 'center' && showContent">
36
+ <ste-icon code="&#xe6a0;" size="40" color="#fff"></ste-icon>
37
+ </view>
38
+ </view>
39
+ </template>
40
+ <script>
41
+ import utils from '../../utils/utils.js';
42
+ const DEFAULT_BORDER_RADIUS = 32;
43
+ /**
44
+ * ste-popup 弹出层
45
+ * @description 弹出层组件
46
+ * @tutorial https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui&menu=%E7%BB%84%E4%BB%B6&active=ste-popup
47
+ * @property {Boolean} show 是否显示弹出层,使用sync修饰符来双向绑定 默认 false
48
+ * @property {String} backgroundColor 内容容器的背景色 默认 #ffffff
49
+ * @property {Boolean} isMaskClick 是否可以点击遮罩层关闭 默认 true
50
+ * @property {Number|String} width 内容区宽度
51
+ * @property {Number|String} height 内容区高度
52
+ * @property {String} position 弹出位置 默认 center
53
+ * @value center 中 {String}
54
+ * @value top 上 {String}
55
+ * @value bottom 下 {String}
56
+ * @value left 左 {String}
57
+ * @value right 右 {String}
58
+ * @property {Boolean} round 是否圆角 默认 false
59
+ * @property {Boolean} showClose 是否右上角显示关闭图标 默认 true
60
+ * @property {Number|String} offsetX 根据弹出位置,设置X轴偏移量,单位px 默认 0
61
+ * @property {Number|String} offsetY 根据弹出位置,设置Y轴偏移量,单位px 默认 0
62
+ * @property {Number} duration 动画持续时间,单位ms
63
+ * @property {Number} zIndex 弹窗层级z-index
64
64
  * @property {Boolean} keepContent 隐藏后是否不销毁弹窗内容元素 默认 true
65
- * @property {Boolean} appendToBody 是否将弹窗挂载到body下(仅H5|APP有效)默认 false
66
- * @event {Function} close 弹窗关闭动画执行完毕事件
67
- * @event {Function} open 弹窗打开动画执行完毕事件
68
- * @event {Function} maskClick 遮罩点击事件
69
- **/
70
- export default {
71
- group: '基础组件',
72
- title: 'Popup 弹出层',
73
- name: 'ste-popup',
74
- props: {
75
- // 打开或者关闭弹窗,必须使用.sync进行双向绑定
76
- show: {
77
- type: [Boolean, null],
78
- default: false
79
- },
80
- backgroundColor: {
81
- type: [String, null],
82
- default: '#ffffff'
83
- },
84
- // 是否显示遮罩
85
- showMask: {
86
- type: [Boolean, null],
87
- default: true
88
- },
89
- // 蒙版点击是否关闭弹窗
90
- isMaskClick: {
91
- type: [Boolean, null],
92
- default: true
93
- },
94
- // 弹窗内容层宽度
95
- width: {
96
- type: [Number, String, null],
97
- default: '100vw'
98
- },
99
- // 弹窗内容层高度
100
- height: {
101
- type: [Number, String, null],
102
- default: 'auto'
103
- },
104
- // 位置 center top bottom left right
105
- position: {
106
- type: [String, null],
107
- default: 'center'
108
- },
109
- round: {
110
- type: [Boolean, null],
111
- default: false
112
- },
113
- showClose: {
114
- type: [Boolean, null],
115
- default: true
116
- },
117
- offsetX: {
118
- type: [Number, String, null],
119
- default: 0
120
- },
121
- offsetY: {
122
- type: [Number, String, null],
123
- default: 0
124
- },
125
- // 动画持续时间
126
- duration: {
127
- type: [Number, null, null],
128
- default: 200
129
- },
130
- // 弹窗z-index
131
- zIndex: {
132
- type: [Number, String, null],
133
- default: 998
134
- },
135
- // 是否在动画完成后渲染或销毁内容元素
136
- keepContent: {
137
- type: [Boolean, null],
138
- default: true
139
- },
140
- // 是否将弹窗挂载到body下(仅H5|APP有效)
141
- appendToBody: {
142
- type: [Boolean, null],
143
- default: false
144
- }
145
- },
146
- data() {
147
- return {
148
- pageDisplay: 'none',
149
- animationData: null,
150
- overlayAnimationData: null,
151
- animationProp: {
152
- duration: this.duration,
153
- timingFunction: 'ease-out'
154
- },
155
- clickTask: null,
156
- showContent: false // 配合keepContent属性来渲染或销毁内容元素
157
- };
158
- },
159
- created() {
160
- if (this.show) {
161
- this.beginAnimation();
162
- }
163
- },
164
- mounted() {},
165
- computed: {
166
- cmpPageStyle() {
167
- return {
168
- zIndex: this.zIndex,
169
- display: this.pageDisplay,
170
- backgroundColor: this.showMask ? 'rgba(0, 0, 0, 0.6)' : 'transparent',
171
- '--content-border-radius': utils.formatPx(this.round ? DEFAULT_BORDER_RADIUS : 0),
172
- '--content-height': utils.formatPx(this.height / 2)
173
- };
174
- },
175
- cmpContentStyle() {
176
- let style = {
177
- width: utils.formatPx(this.width),
178
- height: utils.formatPx(this.height),
179
- backgroundColor: this.backgroundColor
180
- };
181
-
182
- if (this.position === 'center') {
183
- } else if (this.position === 'bottom') {
184
- } else if (this.position === 'top') {
185
- } else if (this.position === 'left') {
186
- } else if (this.position === 'right') {
187
- }
188
-
189
- return style;
190
- }
191
- },
192
- watch: {
193
- show: {
194
- handler(newVal) {
195
- if (newVal) {
196
- this.beginAnimation();
197
- } else {
198
- this.endAnimation();
199
- }
200
- }
201
- }
202
- },
203
- methods: {
204
- touchmove(e) {
205
- // TODO nvue 取消冒泡
206
- e.stopPropagation();
207
- },
208
- onMaskClick() {
209
- this.$emit('clickMask');
210
- if (this.isMaskClick) {
211
- this.close();
212
- }
213
- },
214
- // 关闭弹窗
215
- async close() {
216
- if (this.clickTask) {
217
- return;
218
- }
219
- let next = true;
220
- this.allowStopStatus = false;
221
- this.clickTask = new Promise((resolve, reject) => {
222
- this.$emit(
223
- 'close',
224
- () => (next = false),
225
- () => resolve(),
226
- () => reject()
227
- );
228
- });
229
- if (!next) {
230
- await this.clickTask;
231
- }
232
- this.endAnimation();
233
- this.$emit('update:show', false);
234
- setTimeout(() => {
235
- this.clickTask = null;
236
- }, this.duration);
237
- },
238
- allowStop() {
239
- this.allowStopStatus = true;
240
- },
241
- // 打开弹窗时的动画
242
- async beginAnimation() {
243
- this.pageDisplay = 'flex';
244
- await utils.sleep(50);
245
- let animation = uni.createAnimation(this.animationProp);
246
- let overlayAnimation = uni.createAnimation(this.animationProp);
247
- overlayAnimation.opacity(1).step({
248
- duration: this.duration
249
- });
250
-
251
- if (this.position === 'center') {
252
- animation.scale(1).translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
253
- } else if (this.position === 'top' || this.position === 'bottom') {
254
- animation.translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
255
- } else if (this.position === 'left' || this.position === 'right') {
256
- animation.translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
257
- }
258
- this.overlayAnimationData = overlayAnimation.export();
259
- this.animationData = animation.export();
260
-
261
- setTimeout(() => {
262
- this.showContent = true;
263
- this.$emit('open-after');
264
- }, this.duration);
265
- },
266
- endAnimation() {
267
- let animation = uni.createAnimation(this.animationProp);
268
- let overlayAnimation = uni.createAnimation(this.animationProp);
269
- overlayAnimation.opacity(0).step();
270
-
271
- if (this.position === 'center') {
272
- animation.scale(0).step();
273
- } else if (this.position === 'top' || this.position === 'bottom') {
274
- animation.translateY(this.position == 'top' ? '-100%' : '100%').step();
275
- } else if (this.position === 'left' || this.position === 'right') {
276
- animation.translateX(this.position == 'left' ? '-100%' : '100%').step();
277
- }
278
-
279
- this.overlayAnimationData = overlayAnimation.export();
280
- this.animationData = animation.export();
281
-
282
- setTimeout(() => {
283
- this.pageDisplay = 'none';
284
- this.showContent = false;
285
- }, this.duration);
286
- }
287
- }
288
- };
289
- </script>
290
-
291
- <!-- #ifdef H5 || APP-PLUS -->
292
- <script module="renderModule" lang="renderjs">
293
- export default {
294
- data() {
295
- return {
296
- popupElement: null,
297
- placeholder: null,
298
- isInitialized: false,
299
- };
300
- },
301
- mounted() {
302
- this.initPopup();
303
- },
304
- methods: {
305
- initPopup() {
306
- if (this.isInitialized || !this.$el) return;
307
- const appendToBody = this.$ownerInstance.$vm.appendToBody
308
- const uid = this.$el.className?.match(/ste-popup-(\d+)/)?.[1];
309
- if (uid && appendToBody) {
310
- this.popupElement = document.querySelector(`.ste-popup-${uid}`);
311
- this.isInitialized = true;
312
- // 初始化完成后尝试挂载
313
- this.tryMountToBody();
314
- }
315
- },
316
- tryMountToBody() {
317
- // 创建占位元素
318
- this.placeholder = document.createComment('popup-placeholder');
319
- this.popupElement.parentNode.insertBefore(this.placeholder, this.popupElement);
320
- // 移动到 body
321
- document.body.appendChild(this.popupElement);
322
- }
323
- }
324
- };
325
- </script>
326
- <!-- #endif -->
327
-
328
- <style lang="scss" scoped>
329
- .ste-popup {
330
- height: 100vh;
331
- width: 100vw;
332
- overflow: hidden;
333
- position: fixed;
334
- left: 0;
335
- top: 0;
336
- overflow: hidden;
337
- justify-content: center;
338
- align-items: center;
339
- touch-action: none;
340
-
341
- .close-icon-box-center {
342
- position: absolute;
343
- color: #fff;
344
- top: calc(50% + var(--content-height) + 40rpx);
345
- left: 50%;
346
- transform: translate(-50%, 0);
347
- display: flex;
348
- }
349
- }
350
-
351
- .content {
352
- display: inline-block;
353
- opacity: 1;
354
- overflow-y: auto;
355
- position: absolute;
356
-
357
- .close-icon-box {
358
- position: absolute;
359
- right: 24rpx;
360
- top: 24rpx;
361
- display: flex;
362
- }
363
-
364
- &.center {
365
- // position: relative;
366
- transform: scale(0);
367
- border-radius: var(--content-border-radius);
368
- }
369
-
370
- &.bottom {
371
- transform: translateY(100%);
372
- left: 0;
373
- bottom: 0;
374
- border-top-left-radius: var(--content-border-radius);
375
- border-top-right-radius: var(--content-border-radius);
376
- }
377
-
378
- &.top {
379
- transform: translateY(-100%);
380
- left: 0;
381
- top: 0;
382
- border-bottom-left-radius: var(--content-border-radius);
383
- border-bottom-right-radius: var(--content-border-radius);
384
- }
385
-
386
- &.left {
387
- transform: translateX(-100%);
388
- left: 0;
389
- top: 0;
390
- border-top-right-radius: var(--content-border-radius);
391
- border-bottom-right-radius: var(--content-border-radius);
392
- }
393
-
394
- &.right {
395
- transform: translateX(100%);
396
- right: 0;
397
- top: 0;
398
- border-top-left-radius: var(--content-border-radius);
399
- border-bottom-left-radius: var(--content-border-radius);
400
- }
401
- }
402
- </style>
65
+ * @property {Boolean} appendToBody 是否将弹窗挂载到body下(仅H5|APP有效)默认 false
66
+ * @event {Function} close 弹窗关闭动画执行完毕事件
67
+ * @event {Function} open 弹窗打开动画执行完毕事件
68
+ * @event {Function} maskClick 遮罩点击事件
69
+ **/
70
+ export default {
71
+ group: '基础组件',
72
+ title: 'Popup 弹出层',
73
+ name: 'ste-popup',
74
+ props: {
75
+ // 打开或者关闭弹窗,必须使用.sync进行双向绑定
76
+ show: {
77
+ type: [Boolean, null],
78
+ default: false
79
+ },
80
+ backgroundColor: {
81
+ type: [String, null],
82
+ default: '#ffffff'
83
+ },
84
+ // 是否显示遮罩
85
+ showMask: {
86
+ type: [Boolean, null],
87
+ default: true
88
+ },
89
+ // 蒙版点击是否关闭弹窗
90
+ isMaskClick: {
91
+ type: [Boolean, null],
92
+ default: true
93
+ },
94
+ // 弹窗内容层宽度
95
+ width: {
96
+ type: [Number, String, null],
97
+ default: '100vw'
98
+ },
99
+ // 弹窗内容层高度
100
+ height: {
101
+ type: [Number, String, null],
102
+ default: 'auto'
103
+ },
104
+ // 位置 center top bottom left right
105
+ position: {
106
+ type: [String, null],
107
+ default: 'center'
108
+ },
109
+ round: {
110
+ type: [Boolean, null],
111
+ default: false
112
+ },
113
+ showClose: {
114
+ type: [Boolean, null],
115
+ default: true
116
+ },
117
+ offsetX: {
118
+ type: [Number, String, null],
119
+ default: 0
120
+ },
121
+ offsetY: {
122
+ type: [Number, String, null],
123
+ default: 0
124
+ },
125
+ // 动画持续时间
126
+ duration: {
127
+ type: [Number, null, null],
128
+ default: 200
129
+ },
130
+ // 弹窗z-index
131
+ zIndex: {
132
+ type: [Number, String, null],
133
+ default: 998
134
+ },
135
+ // 是否在动画完成后渲染或销毁内容元素
136
+ keepContent: {
137
+ type: [Boolean, null],
138
+ default: true
139
+ },
140
+ // 是否将弹窗挂载到body下(仅H5|APP有效)
141
+ appendToBody: {
142
+ type: [Boolean, null],
143
+ default: false
144
+ }
145
+ },
146
+ data() {
147
+ return {
148
+ pageDisplay: 'none',
149
+ animationData: null,
150
+ overlayAnimationData: null,
151
+ animationProp: {
152
+ duration: this.duration,
153
+ timingFunction: 'ease-out'
154
+ },
155
+ clickTask: null,
156
+ showContent: false // 配合keepContent属性来渲染或销毁内容元素
157
+ };
158
+ },
159
+ created() {
160
+ if (this.show) {
161
+ this.beginAnimation();
162
+ }
163
+ },
164
+ mounted() {},
165
+ computed: {
166
+ cmpPageStyle() {
167
+ return {
168
+ zIndex: this.zIndex,
169
+ display: this.pageDisplay,
170
+ backgroundColor: this.showMask ? 'rgba(0, 0, 0, 0.6)' : 'transparent',
171
+ '--content-border-radius': utils.formatPx(this.round ? DEFAULT_BORDER_RADIUS : 0),
172
+ '--content-height': utils.formatPx(this.height / 2)
173
+ };
174
+ },
175
+ cmpContentStyle() {
176
+ let style = {
177
+ width: utils.formatPx(this.width),
178
+ height: utils.formatPx(this.height),
179
+ backgroundColor: this.backgroundColor
180
+ };
181
+
182
+ if (this.position === 'center') {
183
+ } else if (this.position === 'bottom') {
184
+ } else if (this.position === 'top') {
185
+ } else if (this.position === 'left') {
186
+ } else if (this.position === 'right') {
187
+ }
188
+
189
+ return style;
190
+ }
191
+ },
192
+ watch: {
193
+ show: {
194
+ handler(newVal) {
195
+ if (newVal) {
196
+ this.beginAnimation();
197
+ } else {
198
+ this.endAnimation();
199
+ }
200
+ }
201
+ }
202
+ },
203
+ methods: {
204
+ touchmove(e) {
205
+ // TODO nvue 取消冒泡
206
+ e.stopPropagation();
207
+ },
208
+ onMaskClick() {
209
+ this.$emit('clickMask');
210
+ if (this.isMaskClick) {
211
+ this.close();
212
+ }
213
+ },
214
+ // 关闭弹窗
215
+ async close() {
216
+ if (this.clickTask) {
217
+ return;
218
+ }
219
+ let next = true;
220
+ this.allowStopStatus = false;
221
+ this.clickTask = new Promise((resolve, reject) => {
222
+ this.$emit(
223
+ 'close',
224
+ () => (next = false),
225
+ () => resolve(),
226
+ () => reject()
227
+ );
228
+ });
229
+ if (!next) {
230
+ await this.clickTask;
231
+ }
232
+ this.endAnimation();
233
+ this.$emit('update:show', false);
234
+ setTimeout(() => {
235
+ this.clickTask = null;
236
+ }, this.duration);
237
+ },
238
+ allowStop() {
239
+ this.allowStopStatus = true;
240
+ },
241
+ // 打开弹窗时的动画
242
+ async beginAnimation() {
243
+ this.pageDisplay = 'flex';
244
+ await utils.sleep(50);
245
+ let animation = uni.createAnimation(this.animationProp);
246
+ let overlayAnimation = uni.createAnimation(this.animationProp);
247
+ overlayAnimation.opacity(1).step({
248
+ duration: this.duration
249
+ });
250
+
251
+ if (this.position === 'center') {
252
+ animation.scale(1).translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
253
+ } else if (this.position === 'top' || this.position === 'bottom') {
254
+ animation.translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
255
+ } else if (this.position === 'left' || this.position === 'right') {
256
+ animation.translate(utils.formatPx(this.offsetX), utils.formatPx(this.offsetY)).step();
257
+ }
258
+ this.overlayAnimationData = overlayAnimation.export();
259
+ this.animationData = animation.export();
260
+
261
+ setTimeout(() => {
262
+ this.showContent = true;
263
+ this.$emit('open-after');
264
+ }, this.duration);
265
+ },
266
+ endAnimation() {
267
+ let animation = uni.createAnimation(this.animationProp);
268
+ let overlayAnimation = uni.createAnimation(this.animationProp);
269
+ overlayAnimation.opacity(0).step();
270
+
271
+ if (this.position === 'center') {
272
+ animation.scale(0).step();
273
+ } else if (this.position === 'top' || this.position === 'bottom') {
274
+ animation.translateY(this.position == 'top' ? '-100%' : '100%').step();
275
+ } else if (this.position === 'left' || this.position === 'right') {
276
+ animation.translateX(this.position == 'left' ? '-100%' : '100%').step();
277
+ }
278
+
279
+ this.overlayAnimationData = overlayAnimation.export();
280
+ this.animationData = animation.export();
281
+
282
+ setTimeout(() => {
283
+ this.pageDisplay = 'none';
284
+ this.showContent = false;
285
+ }, this.duration);
286
+ }
287
+ }
288
+ };
289
+ </script>
290
+
291
+ <!-- #ifdef H5 || APP-PLUS -->
292
+ <script module="renderModule" lang="renderjs">
293
+ export default {
294
+ data() {
295
+ return {
296
+ popupElement: null,
297
+ placeholder: null,
298
+ isInitialized: false,
299
+ };
300
+ },
301
+ mounted() {
302
+ this.initPopup();
303
+ },
304
+ methods: {
305
+ initPopup() {
306
+ if (this.isInitialized || !this.$el) return;
307
+ const appendToBody = this.$ownerInstance.$vm.appendToBody
308
+ const uid = this.$el.className?.match(/ste-popup-(\d+)/)?.[1];
309
+ if (uid && appendToBody) {
310
+ this.popupElement = document.querySelector(`.ste-popup-${uid}`);
311
+ this.isInitialized = true;
312
+ // 初始化完成后尝试挂载
313
+ this.tryMountToBody();
314
+ }
315
+ },
316
+ tryMountToBody() {
317
+ // 创建占位元素
318
+ this.placeholder = document.createComment('popup-placeholder');
319
+ this.popupElement.parentNode.insertBefore(this.placeholder, this.popupElement);
320
+ // 移动到 body
321
+ document.body.appendChild(this.popupElement);
322
+ }
323
+ }
324
+ };
325
+ </script>
326
+ <!-- #endif -->
327
+
328
+ <style lang="scss" scoped>
329
+ .ste-popup {
330
+ height: 100vh;
331
+ width: 100vw;
332
+ overflow: hidden;
333
+ position: fixed;
334
+ left: 0;
335
+ top: 0;
336
+ overflow: hidden;
337
+ justify-content: center;
338
+ align-items: center;
339
+ touch-action: none;
340
+
341
+ .close-icon-box-center {
342
+ position: absolute;
343
+ color: #fff;
344
+ top: calc(50% + var(--content-height) + 40rpx);
345
+ left: 50%;
346
+ transform: translate(-50%, 0);
347
+ display: flex;
348
+ }
349
+ }
350
+
351
+ .content {
352
+ display: inline-block;
353
+ opacity: 1;
354
+ overflow-y: auto;
355
+ position: absolute;
356
+
357
+ .close-icon-box {
358
+ position: absolute;
359
+ right: 24rpx;
360
+ top: 24rpx;
361
+ display: flex;
362
+ }
363
+
364
+ &.center {
365
+ // position: relative;
366
+ transform: scale(0);
367
+ border-radius: var(--content-border-radius);
368
+ }
369
+
370
+ &.bottom {
371
+ transform: translateY(100%);
372
+ left: 0;
373
+ bottom: 0;
374
+ border-top-left-radius: var(--content-border-radius);
375
+ border-top-right-radius: var(--content-border-radius);
376
+ }
377
+
378
+ &.top {
379
+ transform: translateY(-100%);
380
+ left: 0;
381
+ top: 0;
382
+ border-bottom-left-radius: var(--content-border-radius);
383
+ border-bottom-right-radius: var(--content-border-radius);
384
+ }
385
+
386
+ &.left {
387
+ transform: translateX(-100%);
388
+ left: 0;
389
+ top: 0;
390
+ border-top-right-radius: var(--content-border-radius);
391
+ border-bottom-right-radius: var(--content-border-radius);
392
+ }
393
+
394
+ &.right {
395
+ transform: translateX(100%);
396
+ right: 0;
397
+ top: 0;
398
+ border-top-left-radius: var(--content-border-radius);
399
+ border-bottom-left-radius: var(--content-border-radius);
400
+ }
401
+ }
402
+ </style>