uview-plus 3.1.35 → 3.1.37
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/changelog.md +4 -0
- package/components/u-action-sheet/u-action-sheet.vue +1 -0
- package/components/u-album/u-album.vue +1 -0
- package/components/u-alert/u-alert.vue +1 -0
- package/components/u-avatar/u-avatar.vue +1 -0
- package/components/u-avatar-group/u-avatar-group.vue +1 -0
- package/components/u-back-top/u-back-top.vue +2 -1
- package/components/u-badge/u-badge.vue +1 -1
- package/components/u-calendar/u-calendar.vue +1 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +312 -311
- package/components/u-cell/u-cell.vue +1 -1
- package/components/u-cell-group/u-cell-group.vue +1 -1
- package/components/u-checkbox/u-checkbox.vue +2 -1
- package/components/u-code/u-code.vue +1 -0
- package/components/u-code-input/props.js +13 -5
- package/components/u-code-input/u-code-input.vue +8 -2
- package/components/u-col/u-col.vue +1 -0
- package/components/u-collapse/u-collapse.vue +1 -0
- package/components/u-column-notice/u-column-notice.vue +1 -0
- package/components/u-count-down/u-count-down.vue +164 -163
- package/components/u-count-to/u-count-to.vue +1 -0
- package/components/u-divider/u-divider.vue +1 -0
- package/components/u-dropdown/u-dropdown.vue +127 -129
- package/components/u-form-item/u-form-item.vue +1 -0
- package/components/u-image/u-image.vue +1 -1
- package/components/u-index-anchor/u-index-anchor.vue +1 -1
- package/components/u-index-item/u-index-item.vue +1 -1
- package/components/u-index-list/u-index-list.vue +1 -1
- package/components/u-input/u-input.vue +3 -3
- package/components/u-keyboard/u-keyboard.vue +1 -0
- package/components/u-link/u-link.vue +1 -0
- package/components/u-list/u-list.vue +1 -0
- package/components/u-loadmore/u-loadmore.vue +1 -0
- package/components/u-modal/u-modal.vue +230 -229
- package/components/u-navbar/u-navbar.vue +1 -1
- package/components/u-no-network/u-no-network.vue +1 -0
- package/components/u-notice-bar/u-notice-bar.vue +1 -0
- package/components/u-number-box/u-number-box.vue +1 -1
- package/components/u-number-keyboard/u-number-keyboard.vue +1 -1
- package/components/u-overlay/u-overlay.vue +1 -0
- package/components/u-parse/node/node.vue +2 -2
- package/components/u-parse/parser.js +1333 -1333
- package/components/u-parse/u-parse.vue +5 -5
- package/components/u-popup/u-popup.vue +307 -306
- package/components/u-radio/u-radio.vue +1 -1
- package/components/u-read-more/u-read-more.vue +1 -0
- package/components/u-row/u-row.vue +1 -0
- package/components/u-row-notice/u-row-notice.vue +1 -0
- package/components/u-scroll-list/u-scroll-list.vue +1 -0
- package/components/u-search/u-search.vue +6 -2
- package/components/u-slider/props.js +13 -5
- package/components/u-slider/u-slider.vue +66 -55
- package/components/u-status-bar/u-status-bar.vue +1 -1
- package/components/u-steps/u-steps.vue +1 -1
- package/components/u-steps-item/u-steps-item.vue +1 -1
- package/components/u-subsection/u-subsection.vue +1 -0
- package/components/u-swiper/u-swiper.vue +10 -9
- package/components/u-tabbar-item/u-tabbar-item.vue +1 -0
- package/components/u-tag/u-tag.vue +362 -361
- package/components/u-toolbar/u-toolbar.vue +1 -0
- package/components/u-tooltip/u-tooltip.vue +1 -0
- package/components/u-upload/u-upload.vue +1 -1
- package/package.json +1 -1
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
* @property {Boolean | Number} use-anchor 是否使用锚点链接
|
|
33
33
|
* @event {Function} load dom 结构加载完毕时触发
|
|
34
34
|
* @event {Function} ready 所有图片加载完毕时触发
|
|
35
|
-
* @event {Function}
|
|
36
|
-
* @event {Function}
|
|
35
|
+
* @event {Function} imgTap 图片被点击时触发
|
|
36
|
+
* @event {Function} linkTap 链接被点击时触发
|
|
37
37
|
* @event {Function} play 音视频播放时触发
|
|
38
38
|
* @event {Function} error 媒体加载出错时触发
|
|
39
39
|
*/
|
|
@@ -103,7 +103,7 @@ export default {
|
|
|
103
103
|
useAnchor: [Boolean, Number]
|
|
104
104
|
},
|
|
105
105
|
// #ifdef VUE3
|
|
106
|
-
emits: ['load', 'ready', '
|
|
106
|
+
emits: ['load', 'ready', 'imgTap', 'linkTap', 'play', 'error'],
|
|
107
107
|
// #endif
|
|
108
108
|
// #ifndef APP-PLUS-NVUE
|
|
109
109
|
components: {
|
|
@@ -410,7 +410,7 @@ export default {
|
|
|
410
410
|
break
|
|
411
411
|
// 图片点击
|
|
412
412
|
case 'onImgTap':
|
|
413
|
-
this.$emit('
|
|
413
|
+
this.$emit('imgTap', message.attrs)
|
|
414
414
|
if (this.previewImg) {
|
|
415
415
|
uni.previewImage({
|
|
416
416
|
current: parseInt(message.attrs.i),
|
|
@@ -421,7 +421,7 @@ export default {
|
|
|
421
421
|
// 链接点击
|
|
422
422
|
case 'onLinkTap': {
|
|
423
423
|
const href = message.attrs.href
|
|
424
|
-
this.$emit('
|
|
424
|
+
this.$emit('linkTap', message.attrs)
|
|
425
425
|
if (href) {
|
|
426
426
|
// 锚点跳转
|
|
427
427
|
if (href[0] === '#') {
|
|
@@ -1,306 +1,307 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="u-popup">
|
|
3
|
-
<u-overlay
|
|
4
|
-
:show="show"
|
|
5
|
-
@click="overlayClick"
|
|
6
|
-
v-if="overlay"
|
|
7
|
-
:duration="overlayDuration"
|
|
8
|
-
:customStyle="overlayStyle"
|
|
9
|
-
:opacity="overlayOpacity"
|
|
10
|
-
></u-overlay>
|
|
11
|
-
<u-transition
|
|
12
|
-
:show="show"
|
|
13
|
-
:customStyle="transitionStyle"
|
|
14
|
-
:mode="position"
|
|
15
|
-
:duration="duration"
|
|
16
|
-
@afterEnter="afterEnter"
|
|
17
|
-
@click="clickHandler"
|
|
18
|
-
>
|
|
19
|
-
<view
|
|
20
|
-
class="u-popup__content"
|
|
21
|
-
:style="[contentStyle]"
|
|
22
|
-
@tap.stop="noop"
|
|
23
|
-
>
|
|
24
|
-
<u-status-bar v-if="safeAreaInsetTop"></u-status-bar>
|
|
25
|
-
<slot></slot>
|
|
26
|
-
<view
|
|
27
|
-
v-if="closeable"
|
|
28
|
-
@tap.stop="close"
|
|
29
|
-
class="u-popup__content__close"
|
|
30
|
-
:class="['u-popup__content__close--' + closeIconPos]"
|
|
31
|
-
hover-class="u-popup__content__close--hover"
|
|
32
|
-
hover-stay-time="150"
|
|
33
|
-
>
|
|
34
|
-
<u-icon
|
|
35
|
-
name="close"
|
|
36
|
-
color="#909399"
|
|
37
|
-
size="18"
|
|
38
|
-
bold
|
|
39
|
-
></u-icon>
|
|
40
|
-
</view>
|
|
41
|
-
<u-safe-bottom v-if="safeAreaInsetBottom"></u-safe-bottom>
|
|
42
|
-
</view>
|
|
43
|
-
</u-transition>
|
|
44
|
-
</view>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
import props from './props.js';
|
|
49
|
-
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
50
|
-
import mixin from '../../libs/mixin/mixin.js';
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* popup 弹窗
|
|
54
|
-
* @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
|
|
55
|
-
* @tutorial https://ijry.github.io/uview-plus/components/popup.html
|
|
56
|
-
* @property {Boolean} show 是否展示弹窗 (默认 false )
|
|
57
|
-
* @property {Boolean} overlay 是否显示遮罩 (默认 true )
|
|
58
|
-
* @property {String} mode 弹出方向(默认 'bottom' )
|
|
59
|
-
* @property {String | Number} duration 动画时长,单位ms (默认 300 )
|
|
60
|
-
* @property {String | Number} overlayDuration 遮罩层动画时长,单位ms (默认 350 )
|
|
61
|
-
* @property {Boolean} closeable 是否显示关闭图标(默认 false )
|
|
62
|
-
* @property {Object | String} overlayStyle 自定义遮罩的样式
|
|
63
|
-
* @property {String | Number} overlayOpacity 遮罩透明度,0-1之间(默认 0.5)
|
|
64
|
-
* @property {Boolean} closeOnClickOverlay 点击遮罩是否关闭弹窗 (默认 true )
|
|
65
|
-
* @property {String | Number} zIndex 层级 (默认 10075 )
|
|
66
|
-
* @property {Boolean} safeAreaInsetBottom 是否为iPhoneX留出底部安全距离 (默认 true )
|
|
67
|
-
* @property {Boolean} safeAreaInsetTop 是否留出顶部安全距离(状态栏高度) (默认 false )
|
|
68
|
-
* @property {String} closeIconPos 自定义关闭图标位置(默认 'top-right' )
|
|
69
|
-
* @property {String | Number} round 圆角值(默认 0)
|
|
70
|
-
* @property {Boolean} zoom 当mode=center时 是否开启缩放(默认 true )
|
|
71
|
-
* @property {Object} customStyle 组件的样式,对象形式
|
|
72
|
-
* @event {Function} open 弹出层打开
|
|
73
|
-
* @event {Function} close 弹出层收起
|
|
74
|
-
* @example <u-popup v-model="show"><text>出淤泥而不染,濯清涟而不妖</text></u-popup>
|
|
75
|
-
*/
|
|
76
|
-
export default {
|
|
77
|
-
name: 'u-popup',
|
|
78
|
-
mixins: [mpMixin, mixin, props],
|
|
79
|
-
data() {
|
|
80
|
-
return {
|
|
81
|
-
overlayDuration: this.duration + 50
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
watch: {
|
|
85
|
-
show(newValue, oldValue) {
|
|
86
|
-
if (newValue === true) {
|
|
87
|
-
// #ifdef MP-WEIXIN
|
|
88
|
-
const children = this.$children
|
|
89
|
-
this.retryComputedComponentRect(children)
|
|
90
|
-
// #endif
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
computed: {
|
|
95
|
-
transitionStyle() {
|
|
96
|
-
const style = {
|
|
97
|
-
zIndex: this.zIndex,
|
|
98
|
-
position: 'fixed',
|
|
99
|
-
display: 'flex',
|
|
100
|
-
}
|
|
101
|
-
style[this.mode] = 0
|
|
102
|
-
if (this.mode === 'left') {
|
|
103
|
-
return uni.$u.deepMerge(style, {
|
|
104
|
-
bottom: 0,
|
|
105
|
-
top: 0,
|
|
106
|
-
})
|
|
107
|
-
} else if (this.mode === 'right') {
|
|
108
|
-
return uni.$u.deepMerge(style, {
|
|
109
|
-
bottom: 0,
|
|
110
|
-
top: 0,
|
|
111
|
-
})
|
|
112
|
-
} else if (this.mode === 'top') {
|
|
113
|
-
return uni.$u.deepMerge(style, {
|
|
114
|
-
left: 0,
|
|
115
|
-
right: 0
|
|
116
|
-
})
|
|
117
|
-
} else if (this.mode === 'bottom') {
|
|
118
|
-
return uni.$u.deepMerge(style, {
|
|
119
|
-
left: 0,
|
|
120
|
-
right: 0,
|
|
121
|
-
})
|
|
122
|
-
} else if (this.mode === 'center') {
|
|
123
|
-
return uni.$u.deepMerge(style, {
|
|
124
|
-
alignItems: 'center',
|
|
125
|
-
'justify-content': 'center',
|
|
126
|
-
top: 0,
|
|
127
|
-
left: 0,
|
|
128
|
-
right: 0,
|
|
129
|
-
bottom: 0
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
contentStyle() {
|
|
134
|
-
const style = {}
|
|
135
|
-
// 通过设备信息的safeAreaInsets值来判断是否需要预留顶部状态栏和底部安全局的位置
|
|
136
|
-
// 不使用css方案,是因为nvue不支持css的iPhoneX安全区查询属性
|
|
137
|
-
const {
|
|
138
|
-
safeAreaInsets
|
|
139
|
-
} = uni.$u.sys()
|
|
140
|
-
if (this.mode !== 'center') {
|
|
141
|
-
style.flex = 1
|
|
142
|
-
}
|
|
143
|
-
// 背景色,一般用于设置为transparent,去除默认的白色背景
|
|
144
|
-
if (this.bgColor) {
|
|
145
|
-
style.backgroundColor = this.bgColor
|
|
146
|
-
}
|
|
147
|
-
if(this.round) {
|
|
148
|
-
const value = uni.$u.addUnit(this.round)
|
|
149
|
-
if(this.mode === 'top') {
|
|
150
|
-
style.borderBottomLeftRadius = value
|
|
151
|
-
style.borderBottomRightRadius = value
|
|
152
|
-
} else if(this.mode === 'bottom') {
|
|
153
|
-
style.borderTopLeftRadius = value
|
|
154
|
-
style.borderTopRightRadius = value
|
|
155
|
-
} else if(this.mode === 'center') {
|
|
156
|
-
style.borderRadius = value
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
|
|
160
|
-
},
|
|
161
|
-
position() {
|
|
162
|
-
if (this.mode === 'center') {
|
|
163
|
-
return this.zoom ? 'fade-zoom' : 'fade'
|
|
164
|
-
}
|
|
165
|
-
if (this.mode === 'left') {
|
|
166
|
-
return 'slide-left'
|
|
167
|
-
}
|
|
168
|
-
if (this.mode === 'right') {
|
|
169
|
-
return 'slide-right'
|
|
170
|
-
}
|
|
171
|
-
if (this.mode === 'bottom') {
|
|
172
|
-
return 'slide-up'
|
|
173
|
-
}
|
|
174
|
-
if (this.mode === 'top') {
|
|
175
|
-
return 'slide-down'
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
'u-
|
|
205
|
-
'u-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
$u-popup-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
border-top-
|
|
245
|
-
border-
|
|
246
|
-
border-bottom-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
border-top-
|
|
252
|
-
border-
|
|
253
|
-
border-bottom-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
border-top-
|
|
259
|
-
border-
|
|
260
|
-
border-bottom-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
border-top-
|
|
266
|
-
border-
|
|
267
|
-
border-bottom-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
border-top-
|
|
273
|
-
border-
|
|
274
|
-
border-bottom-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-popup">
|
|
3
|
+
<u-overlay
|
|
4
|
+
:show="show"
|
|
5
|
+
@click="overlayClick"
|
|
6
|
+
v-if="overlay"
|
|
7
|
+
:duration="overlayDuration"
|
|
8
|
+
:customStyle="overlayStyle"
|
|
9
|
+
:opacity="overlayOpacity"
|
|
10
|
+
></u-overlay>
|
|
11
|
+
<u-transition
|
|
12
|
+
:show="show"
|
|
13
|
+
:customStyle="transitionStyle"
|
|
14
|
+
:mode="position"
|
|
15
|
+
:duration="duration"
|
|
16
|
+
@afterEnter="afterEnter"
|
|
17
|
+
@click="clickHandler"
|
|
18
|
+
>
|
|
19
|
+
<view
|
|
20
|
+
class="u-popup__content"
|
|
21
|
+
:style="[contentStyle]"
|
|
22
|
+
@tap.stop="noop"
|
|
23
|
+
>
|
|
24
|
+
<u-status-bar v-if="safeAreaInsetTop"></u-status-bar>
|
|
25
|
+
<slot></slot>
|
|
26
|
+
<view
|
|
27
|
+
v-if="closeable"
|
|
28
|
+
@tap.stop="close"
|
|
29
|
+
class="u-popup__content__close"
|
|
30
|
+
:class="['u-popup__content__close--' + closeIconPos]"
|
|
31
|
+
hover-class="u-popup__content__close--hover"
|
|
32
|
+
hover-stay-time="150"
|
|
33
|
+
>
|
|
34
|
+
<u-icon
|
|
35
|
+
name="close"
|
|
36
|
+
color="#909399"
|
|
37
|
+
size="18"
|
|
38
|
+
bold
|
|
39
|
+
></u-icon>
|
|
40
|
+
</view>
|
|
41
|
+
<u-safe-bottom v-if="safeAreaInsetBottom"></u-safe-bottom>
|
|
42
|
+
</view>
|
|
43
|
+
</u-transition>
|
|
44
|
+
</view>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import props from './props.js';
|
|
49
|
+
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
50
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* popup 弹窗
|
|
54
|
+
* @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
|
|
55
|
+
* @tutorial https://ijry.github.io/uview-plus/components/popup.html
|
|
56
|
+
* @property {Boolean} show 是否展示弹窗 (默认 false )
|
|
57
|
+
* @property {Boolean} overlay 是否显示遮罩 (默认 true )
|
|
58
|
+
* @property {String} mode 弹出方向(默认 'bottom' )
|
|
59
|
+
* @property {String | Number} duration 动画时长,单位ms (默认 300 )
|
|
60
|
+
* @property {String | Number} overlayDuration 遮罩层动画时长,单位ms (默认 350 )
|
|
61
|
+
* @property {Boolean} closeable 是否显示关闭图标(默认 false )
|
|
62
|
+
* @property {Object | String} overlayStyle 自定义遮罩的样式
|
|
63
|
+
* @property {String | Number} overlayOpacity 遮罩透明度,0-1之间(默认 0.5)
|
|
64
|
+
* @property {Boolean} closeOnClickOverlay 点击遮罩是否关闭弹窗 (默认 true )
|
|
65
|
+
* @property {String | Number} zIndex 层级 (默认 10075 )
|
|
66
|
+
* @property {Boolean} safeAreaInsetBottom 是否为iPhoneX留出底部安全距离 (默认 true )
|
|
67
|
+
* @property {Boolean} safeAreaInsetTop 是否留出顶部安全距离(状态栏高度) (默认 false )
|
|
68
|
+
* @property {String} closeIconPos 自定义关闭图标位置(默认 'top-right' )
|
|
69
|
+
* @property {String | Number} round 圆角值(默认 0)
|
|
70
|
+
* @property {Boolean} zoom 当mode=center时 是否开启缩放(默认 true )
|
|
71
|
+
* @property {Object} customStyle 组件的样式,对象形式
|
|
72
|
+
* @event {Function} open 弹出层打开
|
|
73
|
+
* @event {Function} close 弹出层收起
|
|
74
|
+
* @example <u-popup v-model="show"><text>出淤泥而不染,濯清涟而不妖</text></u-popup>
|
|
75
|
+
*/
|
|
76
|
+
export default {
|
|
77
|
+
name: 'u-popup',
|
|
78
|
+
mixins: [mpMixin, mixin, props],
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
overlayDuration: this.duration + 50
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
watch: {
|
|
85
|
+
show(newValue, oldValue) {
|
|
86
|
+
if (newValue === true) {
|
|
87
|
+
// #ifdef MP-WEIXIN
|
|
88
|
+
const children = this.$children
|
|
89
|
+
this.retryComputedComponentRect(children)
|
|
90
|
+
// #endif
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
computed: {
|
|
95
|
+
transitionStyle() {
|
|
96
|
+
const style = {
|
|
97
|
+
zIndex: this.zIndex,
|
|
98
|
+
position: 'fixed',
|
|
99
|
+
display: 'flex',
|
|
100
|
+
}
|
|
101
|
+
style[this.mode] = 0
|
|
102
|
+
if (this.mode === 'left') {
|
|
103
|
+
return uni.$u.deepMerge(style, {
|
|
104
|
+
bottom: 0,
|
|
105
|
+
top: 0,
|
|
106
|
+
})
|
|
107
|
+
} else if (this.mode === 'right') {
|
|
108
|
+
return uni.$u.deepMerge(style, {
|
|
109
|
+
bottom: 0,
|
|
110
|
+
top: 0,
|
|
111
|
+
})
|
|
112
|
+
} else if (this.mode === 'top') {
|
|
113
|
+
return uni.$u.deepMerge(style, {
|
|
114
|
+
left: 0,
|
|
115
|
+
right: 0
|
|
116
|
+
})
|
|
117
|
+
} else if (this.mode === 'bottom') {
|
|
118
|
+
return uni.$u.deepMerge(style, {
|
|
119
|
+
left: 0,
|
|
120
|
+
right: 0,
|
|
121
|
+
})
|
|
122
|
+
} else if (this.mode === 'center') {
|
|
123
|
+
return uni.$u.deepMerge(style, {
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
'justify-content': 'center',
|
|
126
|
+
top: 0,
|
|
127
|
+
left: 0,
|
|
128
|
+
right: 0,
|
|
129
|
+
bottom: 0
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
contentStyle() {
|
|
134
|
+
const style = {}
|
|
135
|
+
// 通过设备信息的safeAreaInsets值来判断是否需要预留顶部状态栏和底部安全局的位置
|
|
136
|
+
// 不使用css方案,是因为nvue不支持css的iPhoneX安全区查询属性
|
|
137
|
+
const {
|
|
138
|
+
safeAreaInsets
|
|
139
|
+
} = uni.$u.sys()
|
|
140
|
+
if (this.mode !== 'center') {
|
|
141
|
+
style.flex = 1
|
|
142
|
+
}
|
|
143
|
+
// 背景色,一般用于设置为transparent,去除默认的白色背景
|
|
144
|
+
if (this.bgColor) {
|
|
145
|
+
style.backgroundColor = this.bgColor
|
|
146
|
+
}
|
|
147
|
+
if(this.round) {
|
|
148
|
+
const value = uni.$u.addUnit(this.round)
|
|
149
|
+
if(this.mode === 'top') {
|
|
150
|
+
style.borderBottomLeftRadius = value
|
|
151
|
+
style.borderBottomRightRadius = value
|
|
152
|
+
} else if(this.mode === 'bottom') {
|
|
153
|
+
style.borderTopLeftRadius = value
|
|
154
|
+
style.borderTopRightRadius = value
|
|
155
|
+
} else if(this.mode === 'center') {
|
|
156
|
+
style.borderRadius = value
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
|
|
160
|
+
},
|
|
161
|
+
position() {
|
|
162
|
+
if (this.mode === 'center') {
|
|
163
|
+
return this.zoom ? 'fade-zoom' : 'fade'
|
|
164
|
+
}
|
|
165
|
+
if (this.mode === 'left') {
|
|
166
|
+
return 'slide-left'
|
|
167
|
+
}
|
|
168
|
+
if (this.mode === 'right') {
|
|
169
|
+
return 'slide-right'
|
|
170
|
+
}
|
|
171
|
+
if (this.mode === 'bottom') {
|
|
172
|
+
return 'slide-up'
|
|
173
|
+
}
|
|
174
|
+
if (this.mode === 'top') {
|
|
175
|
+
return 'slide-down'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
emits: ["open", "close", "click"],
|
|
180
|
+
methods: {
|
|
181
|
+
// 点击遮罩
|
|
182
|
+
overlayClick() {
|
|
183
|
+
if (this.closeOnClickOverlay) {
|
|
184
|
+
this.$emit('close')
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
close(e) {
|
|
188
|
+
this.$emit('close')
|
|
189
|
+
},
|
|
190
|
+
afterEnter() {
|
|
191
|
+
this.$emit('open')
|
|
192
|
+
},
|
|
193
|
+
clickHandler() {
|
|
194
|
+
// 由于中部弹出时,其u-transition占据了整个页面相当于遮罩,此时需要发出遮罩点击事件,是否无法通过点击遮罩关闭弹窗
|
|
195
|
+
if(this.mode === 'center') {
|
|
196
|
+
this.overlayClick()
|
|
197
|
+
}
|
|
198
|
+
this.$emit('click')
|
|
199
|
+
},
|
|
200
|
+
// #ifdef MP-WEIXIN
|
|
201
|
+
retryComputedComponentRect(children) {
|
|
202
|
+
// 组件内部需要计算节点的组件
|
|
203
|
+
const names = ['u-calendar-month', 'u-album', 'u-collapse-item', 'u-dropdown', 'u-index-item', 'u-index-list',
|
|
204
|
+
'u-line-progress', 'u-list-item', 'u-rate', 'u-read-more', 'u-row', 'u-row-notice', 'u-scroll-list',
|
|
205
|
+
'u-skeleton', 'u-slider', 'u-steps-item', 'u-sticky', 'u-subsection', 'u-swipe-action-item', 'u-tabbar',
|
|
206
|
+
'u-tabs', 'u-tooltip'
|
|
207
|
+
]
|
|
208
|
+
// 历遍所有的子组件节点
|
|
209
|
+
for (let i = 0; i < children.length; i++) {
|
|
210
|
+
const child = children[i]
|
|
211
|
+
// 拿到子组件的子组件
|
|
212
|
+
const grandChild = child.$children
|
|
213
|
+
// 判断如果在需要重新初始化的组件数组中名中,并且存在init方法的话,则执行
|
|
214
|
+
if (names.includes(child.$options.name) && typeof child?.init === 'function') {
|
|
215
|
+
// 需要进行一定的延时,因为初始化页面需要时间
|
|
216
|
+
uni.$u.sleep(50).then(() => {
|
|
217
|
+
child.init()
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
// 如果子组件还有孙组件,进行递归历遍
|
|
221
|
+
if (grandChild.length) {
|
|
222
|
+
this.retryComputedComponentRect(grandChild)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// #endif
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
</script>
|
|
230
|
+
|
|
231
|
+
<style lang="scss" scoped>
|
|
232
|
+
@import "../../libs/css/components.scss";
|
|
233
|
+
$u-popup-flex:1 !default;
|
|
234
|
+
$u-popup-content-background-color: #fff !default;
|
|
235
|
+
|
|
236
|
+
.u-popup {
|
|
237
|
+
flex: $u-popup-flex;
|
|
238
|
+
|
|
239
|
+
&__content {
|
|
240
|
+
background-color: $u-popup-content-background-color;
|
|
241
|
+
position: relative;
|
|
242
|
+
|
|
243
|
+
&--round-top {
|
|
244
|
+
border-top-left-radius: 0;
|
|
245
|
+
border-top-right-radius: 0;
|
|
246
|
+
border-bottom-left-radius: 10px;
|
|
247
|
+
border-bottom-right-radius: 10px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&--round-left {
|
|
251
|
+
border-top-left-radius: 0;
|
|
252
|
+
border-top-right-radius: 10px;
|
|
253
|
+
border-bottom-left-radius: 0;
|
|
254
|
+
border-bottom-right-radius: 10px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&--round-right {
|
|
258
|
+
border-top-left-radius: 10px;
|
|
259
|
+
border-top-right-radius: 0;
|
|
260
|
+
border-bottom-left-radius: 10px;
|
|
261
|
+
border-bottom-right-radius: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&--round-bottom {
|
|
265
|
+
border-top-left-radius: 10px;
|
|
266
|
+
border-top-right-radius: 10px;
|
|
267
|
+
border-bottom-left-radius: 0;
|
|
268
|
+
border-bottom-right-radius: 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&--round-center {
|
|
272
|
+
border-top-left-radius: 10px;
|
|
273
|
+
border-top-right-radius: 10px;
|
|
274
|
+
border-bottom-left-radius: 10px;
|
|
275
|
+
border-bottom-right-radius: 10px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
&__close {
|
|
279
|
+
position: absolute;
|
|
280
|
+
|
|
281
|
+
&--hover {
|
|
282
|
+
opacity: 0.4;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&__close--top-left {
|
|
287
|
+
top: 15px;
|
|
288
|
+
left: 15px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
&__close--top-right {
|
|
292
|
+
top: 15px;
|
|
293
|
+
right: 15px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
&__close--bottom-left {
|
|
297
|
+
bottom: 15px;
|
|
298
|
+
left: 15px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&__close--bottom-right {
|
|
302
|
+
right: 15px;
|
|
303
|
+
bottom: 15px;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
</style>
|