@10yun/cv-mobile-ui 0.4.2 → 0.4.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 (166) hide show
  1. package/package.json +1 -1
  2. package/ui-uni/amap-wx/js/util.js +166 -158
  3. package/ui-uni/page-foot/page-foot.vue +38 -0
  4. package/ui-uni/page-head/page-head.vue +16 -0
  5. package/ui-uni/product.vue +52 -52
  6. package/ui-uni/u-charts/u-charts.js +743 -1092
  7. package/ui-uni/u-link/u-link.vue +59 -0
  8. package/ui-uni/uni-badge/uni-badge.vue +250 -0
  9. package/ui-uni/uni-calendar/calendar.js +546 -0
  10. package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
  11. package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
  12. package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
  13. package/ui-uni/uni-card/uni-card.vue +420 -0
  14. package/ui-uni/uni-col/uni-col.vue +2968 -0
  15. package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
  16. package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
  17. package/ui-uni/uni-combox/uni-combox.vue +237 -0
  18. package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
  19. package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
  20. package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
  21. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
  22. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
  23. package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
  24. package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
  25. package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
  26. package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
  27. package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
  28. package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
  29. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
  30. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
  31. package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
  32. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
  33. package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
  34. package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
  35. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
  36. package/ui-uni/uni-drawer/keypress.js +45 -0
  37. package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
  38. package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
  39. package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
  40. package/ui-uni/uni-fab/uni-fab.vue +443 -0
  41. package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
  42. package/ui-uni/uni-fav/uni-fav.vue +136 -0
  43. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
  44. package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
  45. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
  46. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
  47. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
  48. package/ui-uni/uni-forms/uni-forms.vue +467 -0
  49. package/ui-uni/uni-forms/validate.js +486 -0
  50. package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
  51. package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
  52. package/ui-uni/uni-grid/uni-grid.vue +141 -0
  53. package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
  54. package/ui-uni/uni-group/uni-group.vue +123 -0
  55. package/ui-uni/uni-icons/icons.js +132 -0
  56. package/ui-uni/uni-icons/uni-icons.vue +72 -0
  57. package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
  58. package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
  59. package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
  60. package/ui-uni/uni-link/uni-link.vue +117 -0
  61. package/ui-uni/uni-list/uni-list.vue +107 -0
  62. package/ui-uni/uni-list/uni-refresh.vue +65 -0
  63. package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
  64. package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
  65. package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
  66. package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
  67. package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
  68. package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
  69. package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
  70. package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
  71. package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
  72. package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
  73. package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
  74. package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
  75. package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
  76. package/ui-uni/uni-popup/uni-popup.vue +412 -0
  77. package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
  78. package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
  79. package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
  80. package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
  81. package/ui-uni/uni-rate/uni-rate.vue +357 -0
  82. package/ui-uni/uni-row/uni-row.vue +155 -0
  83. package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
  84. package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
  85. package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
  86. package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
  87. package/ui-uni/uni-steps/uni-steps.vue +250 -0
  88. package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
  89. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
  90. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
  91. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
  92. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
  93. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
  94. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
  95. package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
  96. package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
  97. package/ui-uni/uni-table/uni-table.vue +455 -0
  98. package/ui-uni/uni-tag/uni-tag.vue +283 -0
  99. package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
  100. package/ui-uni/uni-td/uni-td.vue +88 -0
  101. package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
  102. package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
  103. package/ui-uni/uni-th/uni-th.vue +259 -0
  104. package/ui-uni/uni-thead/uni-thead.vue +114 -0
  105. package/ui-uni/uni-title/uni-title.vue +171 -0
  106. package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
  107. package/ui-uni/uni-tr/uni-tr.vue +156 -0
  108. package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
  109. package/ui-uni/uni-transition/uni-transition.vue +287 -0
  110. package/ui-cv/cv-badge/cv-badge.vue +0 -249
  111. package/ui-cv/cv-calendar/calendar.js +0 -963
  112. package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
  113. package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
  114. package/ui-cv/cv-card/cv-card.vue +0 -427
  115. package/ui-cv/cv-col/cv-col.vue +0 -2965
  116. package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
  117. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
  118. package/ui-cv/cv-combox/cv-combox.vue +0 -250
  119. package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
  120. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
  121. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
  122. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
  123. package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
  124. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
  125. package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
  126. package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
  127. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
  128. package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
  129. package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
  130. package/ui-cv/cv-drawer/keypress.js +0 -45
  131. package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
  132. package/ui-cv/cv-fab/cv-fab.vue +0 -465
  133. package/ui-cv/cv-fav/cv-fav.vue +0 -150
  134. package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
  135. package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
  136. package/ui-cv/cv-form-base/validate.js +0 -477
  137. package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
  138. package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
  139. package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
  140. package/ui-cv/cv-icon2/icons.js +0 -132
  141. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
  142. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
  143. package/ui-cv/cv-link2/cv-link2.vue +0 -130
  144. package/ui-cv/cv-list/cv-list.vue +0 -107
  145. package/ui-cv/cv-list/cv-refresh.vue +0 -65
  146. package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
  147. package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
  148. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
  149. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
  150. package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
  151. package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
  152. package/ui-cv/cv-popup/cv-popup.vue +0 -429
  153. package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
  154. package/ui-cv/cv-row/cv-row.vue +0 -157
  155. package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
  156. package/ui-cv/cv-steps/cv-steps.vue +0 -293
  157. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
  158. package/ui-cv/cv-table/cv-table.vue +0 -460
  159. package/ui-cv/cv-tag/cv-tag.vue +0 -276
  160. package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
  161. package/ui-cv/cv-td/cv-td.vue +0 -93
  162. package/ui-cv/cv-th/cv-th.vue +0 -270
  163. package/ui-cv/cv-thead/cv-thead.vue +0 -114
  164. package/ui-cv/cv-title/cv-title.vue +0 -168
  165. package/ui-cv/cv-tr/cv-tr.vue +0 -166
  166. package/ui-cv/cv-transition/cv-transition.vue +0 -279
@@ -0,0 +1,412 @@
1
+ <template>
2
+ <view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']" @touchmove.stop.prevent="clear">
3
+ <view @touchstart="touchstart">
4
+ <uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
5
+ <uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
6
+ <view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
7
+ <slot />
8
+ </view>
9
+ </uni-transition>
10
+ </view>
11
+ <!-- #ifdef H5 -->
12
+ <keypress v-if="maskShow" @esc="onTap" />
13
+ <!-- #endif -->
14
+ </view>
15
+ </template>
16
+
17
+ <script>
18
+ // #ifdef H5
19
+ import keypress from './keypress.js'
20
+ // #endif
21
+
22
+ /**
23
+ * PopUp 弹出层
24
+ * @description 弹出层组件,为了解决遮罩弹层的问题
25
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=329
26
+ * @property {String} type = [top|center|bottom|left|right|message|dialog|share] 弹出方式
27
+ * @value top 顶部弹出
28
+ * @value center 中间弹出
29
+ * @value bottom 底部弹出
30
+ * @value left 左侧弹出
31
+ * @value right 右侧弹出
32
+ * @value message 消息提示
33
+ * @value dialog 对话框
34
+ * @value share 底部分享示例
35
+ * @property {Boolean} animation = [ture|false] 是否开启动画
36
+ * @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
37
+ * @property {String} backgroundColor 主窗口背景色
38
+ * @property {Boolean} safeArea 是否适配底部安全区
39
+ * @event {Function} change 打开关闭弹窗触发,e={show: false}
40
+ */
41
+
42
+ export default {
43
+ name: 'uniPopup',
44
+ components: {
45
+ // #ifdef H5
46
+ keypress
47
+ // #endif
48
+ },
49
+ emits: ['change', 'maskClick'],
50
+ props: {
51
+ // 开启动画
52
+ animation: {
53
+ type: Boolean,
54
+ default: true
55
+ },
56
+ // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
57
+ // message: 消息提示 ; dialog : 对话框
58
+ type: {
59
+ type: String,
60
+ default: 'center'
61
+ },
62
+ // maskClick
63
+ maskClick: {
64
+ type: Boolean,
65
+ default: true
66
+ },
67
+ backgroundColor: {
68
+ type: String,
69
+ default: 'none'
70
+ },
71
+ safeArea: {
72
+ type: Boolean,
73
+ default: true
74
+ }
75
+ },
76
+
77
+ watch: {
78
+ /**
79
+ * 监听type类型
80
+ */
81
+ type: {
82
+ handler: function(type) {
83
+ if (!this.config[type]) return
84
+ this[this.config[type]](true)
85
+ },
86
+ immediate: true
87
+ },
88
+ isDesktop: {
89
+ handler: function(newVal) {
90
+ if (!this.config[newVal]) return
91
+ this[this.config[this.type]](true)
92
+ },
93
+ immediate: true
94
+ },
95
+ /**
96
+ * 监听遮罩是否可点击
97
+ * @param {Object} val
98
+ */
99
+ maskClick: {
100
+ handler: function(val) {
101
+ this.mkclick = val
102
+ },
103
+ immediate: true
104
+ }
105
+ },
106
+ data() {
107
+ return {
108
+ duration: 300,
109
+ ani: [],
110
+ showPopup: false,
111
+ showTrans: false,
112
+ popupWidth: 0,
113
+ popupHeight: 0,
114
+ config: {
115
+ top: 'top',
116
+ bottom: 'bottom',
117
+ center: 'center',
118
+ left: 'left',
119
+ right: 'right',
120
+ message: 'top',
121
+ dialog: 'center',
122
+ share: 'bottom'
123
+ },
124
+ maskClass: {
125
+ position: 'fixed',
126
+ bottom: 0,
127
+ top: 0,
128
+ left: 0,
129
+ right: 0,
130
+ backgroundColor: 'rgba(0, 0, 0, 0.4)'
131
+ },
132
+ transClass: {
133
+ position: 'fixed',
134
+ left: 0,
135
+ right: 0
136
+ },
137
+ maskShow: true,
138
+ mkclick: true,
139
+ popupstyle: this.isDesktop ? 'fixforpc-top' : 'top'
140
+ }
141
+ },
142
+ computed: {
143
+ isDesktop() {
144
+ return this.popupWidth >= 500 && this.popupHeight >= 500
145
+ },
146
+ bg() {
147
+ if (this.backgroundColor === '' || this.backgroundColor === 'none') {
148
+ return 'transparent'
149
+ }
150
+ return this.backgroundColor
151
+ }
152
+ },
153
+ mounted() {
154
+ const fixSize = () => {
155
+ const {
156
+ windowWidth,
157
+ windowHeight,
158
+ windowTop,
159
+ safeAreaInsets
160
+ } = uni.getSystemInfoSync()
161
+ this.popupWidth = windowWidth
162
+ this.popupHeight = windowHeight + windowTop
163
+ // 是否适配底部安全区
164
+ if (this.safeArea) {
165
+ this.safeAreaInsets = safeAreaInsets
166
+ } else {
167
+ this.safeAreaInsets = 0
168
+ }
169
+ }
170
+ fixSize()
171
+ // #ifdef H5
172
+ // window.addEventListener('resize', fixSize)
173
+ // this.$once('hook:beforeDestroy', () => {
174
+ // window.removeEventListener('resize', fixSize)
175
+ // })
176
+ // #endif
177
+ },
178
+ created() {
179
+ this.mkclick = this.maskClick
180
+ if (this.animation) {
181
+ this.duration = 300
182
+ } else {
183
+ this.duration = 0
184
+ }
185
+ // TODO 处理 message 组件生命周期异常的问题
186
+ this.messageChild = null
187
+ // TODO 解决头条冒泡的问题
188
+ this.clearPropagation = false
189
+ },
190
+ methods: {
191
+ /**
192
+ * 公用方法,不显示遮罩层
193
+ */
194
+ closeMask() {
195
+ this.maskShow = false
196
+ },
197
+ /**
198
+ * 公用方法,遮罩层禁止点击
199
+ */
200
+ disableMask() {
201
+ this.mkclick = false
202
+ },
203
+ // TODO nvue 取消冒泡
204
+ clear(e) {
205
+ // #ifndef APP-NVUE
206
+ e.stopPropagation()
207
+ // #endif
208
+ this.clearPropagation = true
209
+ },
210
+
211
+ open(direction) {
212
+ let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
213
+ if (!(direction && innerType.indexOf(direction) !== -1)) {
214
+ direction = this.type
215
+ }
216
+ if (!this.config[direction]) {
217
+ console.error('缺少类型:', direction)
218
+ return
219
+ }
220
+ this[this.config[direction]]()
221
+ this.$emit('change', {
222
+ show: true,
223
+ type: direction
224
+ })
225
+ },
226
+ close(type) {
227
+ this.showTrans = false
228
+ this.$emit('change', {
229
+ show: false,
230
+ type: this.type
231
+ })
232
+ clearTimeout(this.timer)
233
+ // // 自定义关闭事件
234
+ // this.customOpen && this.customClose()
235
+ this.timer = setTimeout(() => {
236
+ this.showPopup = false
237
+ }, 300)
238
+ },
239
+ // TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
240
+ touchstart() {
241
+ this.clearPropagation = false
242
+ },
243
+
244
+ onTap() {
245
+ if (this.clearPropagation) {
246
+ // fix by mehaotian 兼容 nvue
247
+ this.clearPropagation = false
248
+ return
249
+ }
250
+ this.$emit('maskClick')
251
+ if (!this.mkclick) return
252
+ this.close()
253
+ },
254
+ /**
255
+ * 顶部弹出样式处理
256
+ */
257
+ top(type) {
258
+ this.popupstyle = this.isDesktop ? 'fixforpc-top' : 'top'
259
+ this.ani = ['slide-top']
260
+ this.transClass = {
261
+ position: 'fixed',
262
+ left: 0,
263
+ right: 0,
264
+ backgroundColor: this.bg
265
+ }
266
+ // TODO 兼容 type 属性 ,后续会废弃
267
+ if (type) return
268
+ this.showPopup = true
269
+ this.showTrans = true
270
+ this.$nextTick(() => {
271
+ if (this.messageChild && this.type === 'message') {
272
+ this.messageChild.timerClose()
273
+ }
274
+ })
275
+ },
276
+ /**
277
+ * 底部弹出样式处理
278
+ */
279
+ bottom(type) {
280
+ this.popupstyle = 'bottom'
281
+ this.ani = ['slide-bottom']
282
+
283
+ this.transClass = {
284
+ position: 'fixed',
285
+ left: 0,
286
+ right: 0,
287
+ bottom: 0,
288
+ paddingBottom: (this.safeAreaInsets && this.safeAreaInsets.bottom) || 0,
289
+ backgroundColor: this.bg
290
+ }
291
+ // TODO 兼容 type 属性 ,后续会废弃
292
+ if (type) return
293
+ this.showPopup = true
294
+ this.showTrans = true
295
+ },
296
+ /**
297
+ * 中间弹出样式处理
298
+ */
299
+ center(type) {
300
+ this.popupstyle = 'center'
301
+ this.ani = ['zoom-out', 'fade']
302
+ this.transClass = {
303
+ position: 'fixed',
304
+ /* #ifndef APP-NVUE */
305
+ display: 'flex',
306
+ flexDirection: 'column',
307
+ /* #endif */
308
+ bottom: 0,
309
+ left: 0,
310
+ right: 0,
311
+ top: 0,
312
+ justifyContent: 'center',
313
+ alignItems: 'center'
314
+ }
315
+ // TODO 兼容 type 属性 ,后续会废弃
316
+ if (type) return
317
+ this.showPopup = true
318
+ this.showTrans = true
319
+ },
320
+ left(type) {
321
+ this.popupstyle = 'left'
322
+ this.ani = ['slide-left']
323
+ this.transClass = {
324
+ position: 'fixed',
325
+ left: 0,
326
+ bottom: 0,
327
+ top: 0,
328
+ backgroundColor: this.bg,
329
+ /* #ifndef APP-NVUE */
330
+ display: 'flex',
331
+ flexDirection: 'column'
332
+ /* #endif */
333
+ }
334
+ // TODO 兼容 type 属性 ,后续会废弃
335
+ if (type) return
336
+ this.showPopup = true
337
+ this.showTrans = true
338
+ },
339
+ right(type) {
340
+ this.popupstyle = 'right'
341
+ this.ani = ['slide-right']
342
+ this.transClass = {
343
+ position: 'fixed',
344
+ bottom: 0,
345
+ right: 0,
346
+ top: 0,
347
+ backgroundColor: this.bg,
348
+ /* #ifndef APP-NVUE */
349
+ display: 'flex',
350
+ flexDirection: 'column'
351
+ /* #endif */
352
+ }
353
+ // TODO 兼容 type 属性 ,后续会废弃
354
+ if (type) return
355
+ this.showPopup = true
356
+ this.showTrans = true
357
+ }
358
+ }
359
+ }
360
+ </script>
361
+ <style scoped>
362
+ @charset "UTF-8";
363
+
364
+ .uni-popup {
365
+ position: fixed;
366
+ /* #ifndef APP-NVUE */
367
+ z-index: 99;
368
+ /* #endif */
369
+ }
370
+
371
+ .uni-popup.top,
372
+ .uni-popup.left,
373
+ .uni-popup.right {
374
+ /* #ifdef H5 */
375
+ top: var(--window-top);
376
+ /* #endif */
377
+ /* #ifndef H5 */
378
+ top: 0;
379
+ /* #endif */
380
+ }
381
+
382
+ .uni-popup .uni-popup__wrapper {
383
+ /* #ifndef APP-NVUE */
384
+ display: block;
385
+ /* #endif */
386
+ position: relative;
387
+ /* iphonex 等安全区设置,底部安全区适配 */
388
+ /* #ifndef APP-NVUE */
389
+ /* #endif */
390
+ }
391
+
392
+ .uni-popup .uni-popup__wrapper.left,
393
+ .uni-popup .uni-popup__wrapper.right {
394
+ /* #ifdef H5 */
395
+ padding-top: var(--window-top);
396
+ /* #endif */
397
+ /* #ifndef H5 */
398
+ padding-top: 0;
399
+ /* #endif */
400
+ flex: 1;
401
+ }
402
+
403
+ .fixforpc-z-index {
404
+ /* #ifndef APP-NVUE */
405
+ z-index: 999;
406
+ /* #endif */
407
+ }
408
+
409
+ .fixforpc-top {
410
+ top: 0;
411
+ }
412
+ </style>
@@ -0,0 +1,143 @@
1
+ <template>
2
+ <view class="uni-popup-message">
3
+ <view class="uni-popup-message__box fixforpc-width" :class="'uni-popup__'+type">
4
+ <slot>
5
+ <text class="uni-popup-message-text" :class="'uni-popup__'+type+'-text'">{{message}}</text>
6
+ </slot>
7
+ </view>
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ import popup from '../uni-popup/popup.js'
13
+ /**
14
+ * PopUp 弹出层-消息提示
15
+ * @description 弹出层-消息提示
16
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=329
17
+ * @property {String} type = [success|warning|info|error] 主题样式
18
+ * @value success 成功
19
+ * @value warning 提示
20
+ * @value info 消息
21
+ * @value error 错误
22
+ * @property {String} message 消息提示文字
23
+ * @property {String} duration 显示时间,设置为 0 则不会自动关闭
24
+ */
25
+
26
+ export default {
27
+ name: 'uniPopupMessage',
28
+ mixins: [popup],
29
+ props: {
30
+ /**
31
+ * 主题 success/warning/info/error 默认 success
32
+ */
33
+ type: {
34
+ type: String,
35
+ default: 'success'
36
+ },
37
+ /**
38
+ * 消息文字
39
+ */
40
+ message: {
41
+ type: String,
42
+ default: ''
43
+ },
44
+ /**
45
+ * 显示时间,设置为 0 则不会自动关闭
46
+ */
47
+ duration: {
48
+ type: Number,
49
+ default: 3000
50
+ },
51
+ maskShow: {
52
+ type: Boolean,
53
+ default: false
54
+ }
55
+ },
56
+ data() {
57
+ return {}
58
+ },
59
+ created() {
60
+ this.popup.maskShow = this.maskShow
61
+ this.popup.messageChild = this
62
+ },
63
+ methods: {
64
+ timerClose() {
65
+ if (this.duration === 0) return
66
+ clearTimeout(this.timer)
67
+ this.timer = setTimeout(() => {
68
+ this.popup.close()
69
+ }, this.duration)
70
+ }
71
+ }
72
+ }
73
+ </script>
74
+ <style scoped>
75
+ .uni-popup-message {
76
+ /* #ifndef APP-NVUE */
77
+ display: flex;
78
+ /* #endif */
79
+ flex-direction: row;
80
+ justify-content: center;
81
+ }
82
+
83
+ .uni-popup-message__box {
84
+ background-color: #e1f3d8;
85
+ padding: 10px 15px;
86
+ border-color: #eee;
87
+ border-style: solid;
88
+ border-width: 1px;
89
+ flex: 1;
90
+ }
91
+
92
+ @media screen and (min-width: 500px) {
93
+ .fixforpc-width {
94
+ margin-top: 20px;
95
+ border-radius: 4px;
96
+ flex: none;
97
+ min-width: 380px;
98
+ /* #ifndef APP-NVUE */
99
+ max-width: 50%;
100
+ /* #endif */
101
+ /* #ifdef APP-NVUE */
102
+ max-width: 500px;
103
+ /* #endif */
104
+ }
105
+ }
106
+
107
+ .uni-popup-message-text {
108
+ font-size: 14px;
109
+ padding: 0;
110
+ }
111
+
112
+ .uni-popup__success {
113
+ background-color: #e1f3d8;
114
+ }
115
+
116
+ .uni-popup__success-text {
117
+ color: #67C23A;
118
+ }
119
+
120
+ .uni-popup__warn {
121
+ background-color: #faecd8;
122
+ }
123
+
124
+ .uni-popup__warn-text {
125
+ color: #E6A23C;
126
+ }
127
+
128
+ .uni-popup__error {
129
+ background-color: #fde2e2;
130
+ }
131
+
132
+ .uni-popup__error-text {
133
+ color: #F56C6C;
134
+ }
135
+
136
+ .uni-popup__info {
137
+ background-color: #F2F6FC;
138
+ }
139
+
140
+ .uni-popup__info-text {
141
+ color: #909399;
142
+ }
143
+ </style>