@kengic/uni 0.5.1 → 0.5.2-beta.1

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 (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -15,450 +15,450 @@
15
15
  </template>
16
16
 
17
17
  <script>
18
- // #ifdef H5
19
- import keypress from './keypress.js';
20
- // #endif
18
+ // #ifdef H5
19
+ import keypress from './keypress.js';
20
+ // #endif
21
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
- */
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
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,
45
+ export default {
46
+ name: 'UniPopup',
47
+ components: {
48
+ // #ifdef H5
49
+ keypress,
50
+ // #endif
82
51
  },
83
- maskBackgroundColor: {
84
- type: String,
85
- default: 'rgba(0, 0, 0, 0.4)',
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
+ },
86
87
  },
87
- },
88
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);
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,
97
99
  },
98
- immediate: true,
99
- },
100
- isDesktop: {
101
- handler: function (newVal) {
102
- if (!this.config[newVal]) return;
103
- this[this.config[this.type]](true);
100
+ isDesktop: {
101
+ handler: function (newVal) {
102
+ if (!this.config[newVal]) return;
103
+ this[this.config[this.type]](true);
104
+ },
105
+ immediate: true,
104
106
  },
105
- immediate: true,
106
- },
107
- /**
108
- * 监听遮罩是否可点击
109
- * @param {Object} val
110
- */
111
- maskClick: {
112
- handler: function (val) {
113
- this.mkclick = val;
107
+ /**
108
+ * 监听遮罩是否可点击
109
+ * @param {Object} val
110
+ */
111
+ maskClick: {
112
+ handler: function (val) {
113
+ this.mkclick = val;
114
+ },
115
+ immediate: true,
114
116
  },
115
- immediate: true,
116
- },
117
- isMaskClick: {
118
- handler: function (val) {
119
- this.mkclick = val;
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
120
129
  },
121
- immediate: true,
122
130
  },
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
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
+ };
129
166
  },
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)',
167
+ computed: {
168
+ isDesktop() {
169
+ return this.popupWidth >= 500 && this.popupHeight >= 500;
156
170
  },
157
- transClass: {
158
- position: 'fixed',
159
- left: 0,
160
- right: 0,
171
+ bg() {
172
+ if (this.backgroundColor === '' || this.backgroundColor === 'none') {
173
+ return 'transparent';
174
+ }
175
+ return this.backgroundColor;
161
176
  },
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
177
  },
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() {
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();
235
196
  // #ifdef H5
236
- // fix by mehaotian 处理 h5 滚动穿透的问题
237
- document.getElementsByTagName('body')[0].style.overflow = 'visible';
197
+ // window.addEventListener('resize', fixSize)
198
+ // this.$once('hook:beforeDestroy', () => {
199
+ // window.removeEventListener('resize', fixSize)
200
+ // })
238
201
  // #endif
239
202
  },
240
- /**
241
- * 公用方法,不显示遮罩层
242
- */
243
- closeMask() {
244
- this.maskShow = false;
203
+ // #ifndef VUE3
204
+ // TODO vue2
205
+ destroyed() {
206
+ this.setH5Visible();
245
207
  },
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;
208
+ // #endif
209
+ // #ifdef VUE3
210
+ // TODO vue3
211
+ unmounted() {
212
+ this.setH5Visible();
258
213
  },
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;
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;
268
221
  }
269
- if (!this.config[direction]) {
270
- console.error('缺少类型:', direction);
271
- return;
222
+ if (this.animation) {
223
+ this.duration = 100;
224
+ } else {
225
+ this.duration = 0;
272
226
  }
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() {
227
+ // TODO 处理 message 组件生命周期异常的问题
228
+ this.messageChild = null;
229
+ // TODO 解决头条冒泡的问题
294
230
  this.clearPropagation = false;
231
+ this.maskClass.backgroundColor = this.maskBackgroundColor;
295
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
+ },
296
259
 
297
- onTap() {
298
- if (this.clearPropagation) {
299
- // fix by mehaotian 兼容 nvue
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() {
300
294
  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();
295
+ },
296
+
297
+ onTap() {
298
+ if (this.clearPropagation) {
299
+ // fix by mehaotian 兼容 nvue
300
+ this.clearPropagation = false;
301
+ return;
326
302
  }
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;
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
+ },
409
410
  },
410
- },
411
- };
411
+ };
412
412
  </script>
413
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 {
414
+ .uni-popup {
415
+ position: fixed;
432
416
  /* #ifndef APP-NVUE */
433
- display: block;
434
- /* #endif */
435
- position: relative;
417
+ z-index: 99;
436
418
 
437
- /* iphonex 等安全区设置,底部安全区适配 */
438
- /* #ifndef APP-NVUE */
439
- // padding-bottom: constant(safe-area-inset-bottom);
440
- // padding-bottom: env(safe-area-inset-bottom);
441
419
  /* #endif */
420
+ &.top,
442
421
  &.left,
443
422
  &.right {
444
423
  /* #ifdef H5 */
445
- padding-top: var(--window-top);
424
+ top: var(--window-top);
446
425
  /* #endif */
447
426
  /* #ifndef H5 */
448
- padding-top: 0;
427
+ top: 0;
449
428
  /* #endif */
450
- flex: 1;
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
+ }
451
452
  }
452
453
  }
453
- }
454
454
 
455
- .fixforpc-z-index {
456
- /* #ifndef APP-NVUE */
457
- z-index: 999;
458
- /* #endif */
459
- }
455
+ .fixforpc-z-index {
456
+ /* #ifndef APP-NVUE */
457
+ z-index: 999;
458
+ /* #endif */
459
+ }
460
460
 
461
- .fixforpc-top {
462
- top: 0;
463
- }
461
+ .fixforpc-top {
462
+ top: 0;
463
+ }
464
464
  </style>