@kengic/uni 0.3.2-beta.10

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/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +5 -0
  4. package/dist/src/consts/i18n/en.d.ts +45 -0
  5. package/dist/src/consts/i18n/index.d.ts +90 -0
  6. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  7. package/dist/src/consts/index.d.ts +1 -0
  8. package/dist/src/index.d.ts +2 -0
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/kg.util.d.ts +5 -0
  11. package/dist/uni-ui/index.ts +11 -0
  12. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  13. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  14. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  15. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  16. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  17. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  18. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  19. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  20. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  21. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  22. package/dist/uni-ui/uni-calendar/util.js +360 -0
  23. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  24. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  25. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  26. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  27. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  28. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  29. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  30. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  31. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  32. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  33. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  34. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  35. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  36. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  37. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  38. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  39. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  40. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  41. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  42. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  43. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  44. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  45. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  46. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  47. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  48. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  49. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  50. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  51. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  52. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  53. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  54. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  55. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  56. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  57. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  58. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  59. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  60. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  61. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  62. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  63. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  64. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  65. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  66. package/dist/uni-ui/uni-forms/utils.js +293 -0
  67. package/dist/uni-ui/uni-forms/validate.js +486 -0
  68. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  69. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  70. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  71. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  72. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  73. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  74. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  75. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  76. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  77. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  78. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  79. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  80. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  81. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  82. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  83. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  84. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  85. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  86. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  87. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  88. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  89. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  90. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  91. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  92. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  93. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  94. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  95. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  96. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  97. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  98. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  99. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  100. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  101. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  102. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  103. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  104. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  105. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  106. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  107. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  108. package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
  109. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  110. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  111. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  112. package/dist/uni-ui/uni-popup/popup.js +23 -0
  113. package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
  114. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  115. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  116. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  117. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  118. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  119. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  120. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  121. package/dist/uni-ui/uni-scss/index.scss +1 -0
  122. package/dist/uni-ui/uni-scss/package.json +82 -0
  123. package/dist/uni-ui/uni-scss/readme.md +4 -0
  124. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  125. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  126. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  127. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  128. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  129. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  130. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  131. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  132. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  133. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  134. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  135. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  136. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  137. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  138. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  139. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  140. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  141. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  142. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  143. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  144. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  145. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  146. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  147. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  148. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  149. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  150. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  151. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  152. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  153. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  154. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  155. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  156. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  157. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  158. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  159. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  160. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  161. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  162. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  163. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  164. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  165. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  166. package/package.json +90 -0
@@ -0,0 +1,464 @@
1
+ <template>
2
+ <view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']">
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 = [true|false] 是否开启动画
36
+ * @property {Boolean} maskClick = [true|false] 蒙版点击是否关闭弹窗(废弃)
37
+ * @property {Boolean} isMaskClick = [true|false] 蒙版点击是否关闭弹窗
38
+ * @property {String} backgroundColor 主窗口背景色
39
+ * @property {String} maskBackgroundColor 蒙版颜色
40
+ * @property {Boolean} safeArea 是否适配底部安全区
41
+ * @event {Function} change 打开关闭弹窗触发,e={show: false}
42
+ * @event {Function} maskClick 点击遮罩触发
43
+ */
44
+
45
+ export default {
46
+ name: 'UniPopup',
47
+ components: {
48
+ // #ifdef H5
49
+ keypress,
50
+ // #endif
51
+ },
52
+ emits: ['change', 'maskClick'],
53
+ props: {
54
+ // 开启动画
55
+ animation: {
56
+ type: Boolean,
57
+ default: true,
58
+ },
59
+ // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
60
+ // message: 消息提示 ; dialog : 对话框
61
+ type: {
62
+ type: String,
63
+ default: 'center',
64
+ },
65
+ // maskClick
66
+ isMaskClick: {
67
+ type: Boolean,
68
+ default: null,
69
+ },
70
+ // TODO 2 个版本后废弃属性 ,使用 isMaskClick
71
+ maskClick: {
72
+ type: Boolean,
73
+ default: null,
74
+ },
75
+ backgroundColor: {
76
+ type: String,
77
+ default: 'none',
78
+ },
79
+ safeArea: {
80
+ type: Boolean,
81
+ default: true,
82
+ },
83
+ maskBackgroundColor: {
84
+ type: String,
85
+ default: 'rgba(0, 0, 0, 0.4)',
86
+ },
87
+ },
88
+
89
+ watch: {
90
+ /**
91
+ * 监听type类型
92
+ */
93
+ type: {
94
+ handler: function (type) {
95
+ if (!this.config[type]) return;
96
+ this[this.config[type]](true);
97
+ },
98
+ immediate: true,
99
+ },
100
+ isDesktop: {
101
+ handler: function (newVal) {
102
+ if (!this.config[newVal]) return;
103
+ this[this.config[this.type]](true);
104
+ },
105
+ immediate: true,
106
+ },
107
+ /**
108
+ * 监听遮罩是否可点击
109
+ * @param {Object} val
110
+ */
111
+ maskClick: {
112
+ handler: function (val) {
113
+ this.mkclick = val;
114
+ },
115
+ immediate: true,
116
+ },
117
+ isMaskClick: {
118
+ handler: function (val) {
119
+ this.mkclick = val;
120
+ },
121
+ immediate: true,
122
+ },
123
+ // H5 下禁止底部滚动
124
+ showPopup(show) {
125
+ // #ifdef H5
126
+ // fix by mehaotian 处理 h5 滚动穿透的问题
127
+ document.getElementsByTagName('body')[0].style.overflow = show ? 'hidden' : 'visible';
128
+ // #endif
129
+ },
130
+ },
131
+ data() {
132
+ return {
133
+ duration: 300,
134
+ ani: [],
135
+ showPopup: false,
136
+ showTrans: false,
137
+ popupWidth: 0,
138
+ popupHeight: 0,
139
+ config: {
140
+ top: 'top',
141
+ bottom: 'bottom',
142
+ center: 'center',
143
+ left: 'left',
144
+ right: 'right',
145
+ message: 'top',
146
+ dialog: 'center',
147
+ share: 'bottom',
148
+ },
149
+ maskClass: {
150
+ position: 'fixed',
151
+ bottom: 0,
152
+ top: 0,
153
+ left: 0,
154
+ right: 0,
155
+ backgroundColor: 'rgba(0, 0, 0, 0.4)',
156
+ },
157
+ transClass: {
158
+ position: 'fixed',
159
+ left: 0,
160
+ right: 0,
161
+ },
162
+ maskShow: true,
163
+ mkclick: true,
164
+ popupstyle: this.isDesktop ? 'fixforpc-top' : 'top',
165
+ };
166
+ },
167
+ computed: {
168
+ isDesktop() {
169
+ return this.popupWidth >= 500 && this.popupHeight >= 500;
170
+ },
171
+ bg() {
172
+ if (this.backgroundColor === '' || this.backgroundColor === 'none') {
173
+ return 'transparent';
174
+ }
175
+ return this.backgroundColor;
176
+ },
177
+ },
178
+ mounted() {
179
+ const fixSize = () => {
180
+ const { windowWidth, windowHeight, windowTop, safeArea, screenHeight, safeAreaInsets } = uni.getSystemInfoSync();
181
+ this.popupWidth = windowWidth;
182
+ this.popupHeight = windowHeight + (windowTop || 0);
183
+ // TODO fix by mehaotian 是否适配底部安全区 ,目前微信ios 、和 app ios 计算有差异,需要框架修复
184
+ if (safeArea && this.safeArea) {
185
+ // #ifdef MP-WEIXIN
186
+ this.safeAreaInsets = screenHeight - safeArea.bottom;
187
+ // #endif
188
+ // #ifndef MP-WEIXIN
189
+ this.safeAreaInsets = safeAreaInsets.bottom;
190
+ // #endif
191
+ } else {
192
+ this.safeAreaInsets = 0;
193
+ }
194
+ };
195
+ fixSize();
196
+ // #ifdef H5
197
+ // window.addEventListener('resize', fixSize)
198
+ // this.$once('hook:beforeDestroy', () => {
199
+ // window.removeEventListener('resize', fixSize)
200
+ // })
201
+ // #endif
202
+ },
203
+ // #ifndef VUE3
204
+ // TODO vue2
205
+ destroyed() {
206
+ this.setH5Visible();
207
+ },
208
+ // #endif
209
+ // #ifdef VUE3
210
+ // TODO vue3
211
+ unmounted() {
212
+ this.setH5Visible();
213
+ },
214
+ // #endif
215
+ created() {
216
+ // this.mkclick = this.isMaskClick || this.maskClick
217
+ if (this.isMaskClick === null && this.maskClick === null) {
218
+ this.mkclick = true;
219
+ } else {
220
+ this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
221
+ }
222
+ if (this.animation) {
223
+ this.duration = 100;
224
+ } else {
225
+ this.duration = 0;
226
+ }
227
+ // TODO 处理 message 组件生命周期异常的问题
228
+ this.messageChild = null;
229
+ // TODO 解决头条冒泡的问题
230
+ this.clearPropagation = false;
231
+ this.maskClass.backgroundColor = this.maskBackgroundColor;
232
+ },
233
+ methods: {
234
+ setH5Visible() {
235
+ // #ifdef H5
236
+ // fix by mehaotian 处理 h5 滚动穿透的问题
237
+ document.getElementsByTagName('body')[0].style.overflow = 'visible';
238
+ // #endif
239
+ },
240
+ /**
241
+ * 公用方法,不显示遮罩层
242
+ */
243
+ closeMask() {
244
+ this.maskShow = false;
245
+ },
246
+ /**
247
+ * 公用方法,遮罩层禁止点击
248
+ */
249
+ disableMask() {
250
+ this.mkclick = false;
251
+ },
252
+ // TODO nvue 取消冒泡
253
+ clear(e) {
254
+ // #ifndef APP-NVUE
255
+ e.stopPropagation();
256
+ // #endif
257
+ this.clearPropagation = true;
258
+ },
259
+
260
+ open(direction) {
261
+ // fix by mehaotian 处理快速打开关闭的情况
262
+ if (this.showPopup) {
263
+ return;
264
+ }
265
+ let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share'];
266
+ if (!(direction && innerType.indexOf(direction) !== -1)) {
267
+ direction = this.type;
268
+ }
269
+ if (!this.config[direction]) {
270
+ console.error('缺少类型:', direction);
271
+ return;
272
+ }
273
+ this[this.config[direction]]();
274
+ this.$emit('change', {
275
+ show: true,
276
+ type: direction,
277
+ });
278
+ },
279
+ close(type) {
280
+ this.showTrans = false;
281
+ this.$emit('change', {
282
+ show: false,
283
+ type: this.type,
284
+ });
285
+ clearTimeout(this.timer);
286
+ // // 自定义关闭事件
287
+ // this.customOpen && this.customClose()
288
+ this.timer = setTimeout(() => {
289
+ this.showPopup = false;
290
+ }, 300);
291
+ },
292
+ // TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
293
+ touchstart() {
294
+ this.clearPropagation = false;
295
+ },
296
+
297
+ onTap() {
298
+ if (this.clearPropagation) {
299
+ // fix by mehaotian 兼容 nvue
300
+ this.clearPropagation = false;
301
+ return;
302
+ }
303
+ this.$emit('maskClick');
304
+ if (!this.mkclick) return;
305
+ this.close();
306
+ },
307
+ /**
308
+ * 顶部弹出样式处理
309
+ */
310
+ top(type) {
311
+ this.popupstyle = this.isDesktop ? 'fixforpc-top' : 'top';
312
+ this.ani = ['slide-top'];
313
+ this.transClass = {
314
+ position: 'fixed',
315
+ left: 0,
316
+ right: 0,
317
+ backgroundColor: this.bg,
318
+ };
319
+ // TODO 兼容 type 属性 ,后续会废弃
320
+ if (type) return;
321
+ this.showPopup = true;
322
+ this.showTrans = true;
323
+ this.$nextTick(() => {
324
+ if (this.messageChild && this.type === 'message') {
325
+ this.messageChild.timerClose();
326
+ }
327
+ });
328
+ },
329
+ /**
330
+ * 底部弹出样式处理
331
+ */
332
+ bottom(type) {
333
+ this.popupstyle = 'bottom';
334
+ this.ani = ['slide-bottom'];
335
+ this.transClass = {
336
+ position: 'fixed',
337
+ left: 0,
338
+ right: 0,
339
+ bottom: 0,
340
+ paddingBottom: this.safeAreaInsets + 'px',
341
+ backgroundColor: this.bg,
342
+ };
343
+ // TODO 兼容 type 属性 ,后续会废弃
344
+ if (type) return;
345
+ this.showPopup = true;
346
+ this.showTrans = true;
347
+ },
348
+ /**
349
+ * 中间弹出样式处理
350
+ */
351
+ center(type) {
352
+ this.popupstyle = 'center';
353
+ this.ani = ['zoom-out', 'fade'];
354
+ this.transClass = {
355
+ position: 'fixed',
356
+ /* #ifndef APP-NVUE */
357
+ display: 'flex',
358
+ flexDirection: 'column',
359
+ /* #endif */
360
+ bottom: 0,
361
+ left: 0,
362
+ right: 0,
363
+ top: 0,
364
+ justifyContent: 'center',
365
+ alignItems: 'center',
366
+ };
367
+ // TODO 兼容 type 属性 ,后续会废弃
368
+ if (type) return;
369
+ this.showPopup = true;
370
+ this.showTrans = true;
371
+ },
372
+ left(type) {
373
+ this.popupstyle = 'left';
374
+ this.ani = ['slide-left'];
375
+ this.transClass = {
376
+ position: 'fixed',
377
+ left: 0,
378
+ bottom: 0,
379
+ top: 0,
380
+ backgroundColor: this.bg,
381
+ /* #ifndef APP-NVUE */
382
+ display: 'flex',
383
+ flexDirection: 'column',
384
+ /* #endif */
385
+ };
386
+ // TODO 兼容 type 属性 ,后续会废弃
387
+ if (type) return;
388
+ this.showPopup = true;
389
+ this.showTrans = true;
390
+ },
391
+ right(type) {
392
+ this.popupstyle = 'right';
393
+ this.ani = ['slide-right'];
394
+ this.transClass = {
395
+ position: 'fixed',
396
+ bottom: 0,
397
+ right: 0,
398
+ top: 0,
399
+ backgroundColor: this.bg,
400
+ /* #ifndef APP-NVUE */
401
+ display: 'flex',
402
+ flexDirection: 'column',
403
+ /* #endif */
404
+ };
405
+ // TODO 兼容 type 属性 ,后续会废弃
406
+ if (type) return;
407
+ this.showPopup = true;
408
+ this.showTrans = true;
409
+ },
410
+ },
411
+ };
412
+ </script>
413
+ <style lang="scss">
414
+ .uni-popup {
415
+ position: fixed;
416
+ /* #ifndef APP-NVUE */
417
+ z-index: 99;
418
+
419
+ /* #endif */
420
+ &.top,
421
+ &.left,
422
+ &.right {
423
+ /* #ifdef H5 */
424
+ top: var(--window-top);
425
+ /* #endif */
426
+ /* #ifndef H5 */
427
+ top: 0;
428
+ /* #endif */
429
+ }
430
+
431
+ .uni-popup__wrapper {
432
+ /* #ifndef APP-NVUE */
433
+ display: block;
434
+ /* #endif */
435
+ position: relative;
436
+
437
+ /* iphonex 等安全区设置,底部安全区适配 */
438
+ /* #ifndef APP-NVUE */
439
+ // padding-bottom: constant(safe-area-inset-bottom);
440
+ // padding-bottom: env(safe-area-inset-bottom);
441
+ /* #endif */
442
+ &.left,
443
+ &.right {
444
+ /* #ifdef H5 */
445
+ padding-top: var(--window-top);
446
+ /* #endif */
447
+ /* #ifndef H5 */
448
+ padding-top: 0;
449
+ /* #endif */
450
+ flex: 1;
451
+ }
452
+ }
453
+ }
454
+
455
+ .fixforpc-z-index {
456
+ /* #ifndef APP-NVUE */
457
+ z-index: 999;
458
+ /* #endif */
459
+ }
460
+
461
+ .fixforpc-top {
462
+ top: 0;
463
+ }
464
+ </style>
@@ -0,0 +1,45 @@
1
+ // #ifdef H5
2
+ export default {
3
+ name: 'Keypress',
4
+ props: {
5
+ disable: {
6
+ type: Boolean,
7
+ default: false
8
+ }
9
+ },
10
+ mounted () {
11
+ const keyNames = {
12
+ esc: ['Esc', 'Escape'],
13
+ tab: 'Tab',
14
+ enter: 'Enter',
15
+ space: [' ', 'Spacebar'],
16
+ up: ['Up', 'ArrowUp'],
17
+ left: ['Left', 'ArrowLeft'],
18
+ right: ['Right', 'ArrowRight'],
19
+ down: ['Down', 'ArrowDown'],
20
+ delete: ['Backspace', 'Delete', 'Del']
21
+ }
22
+ const listener = ($event) => {
23
+ if (this.disable) {
24
+ return
25
+ }
26
+ const keyName = Object.keys(keyNames).find(key => {
27
+ const keyName = $event.key
28
+ const value = keyNames[key]
29
+ return value === keyName || (Array.isArray(value) && value.includes(keyName))
30
+ })
31
+ if (keyName) {
32
+ // 避免和其他按键事件冲突
33
+ setTimeout(() => {
34
+ this.$emit(keyName, {})
35
+ }, 0)
36
+ }
37
+ }
38
+ document.addEventListener('keyup', listener)
39
+ this.$once('hook:beforeDestroy', () => {
40
+ document.removeEventListener('keyup', listener)
41
+ })
42
+ },
43
+ render: () => {}
44
+ }
45
+ // #endif