@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
@@ -1,260 +1,251 @@
1
- let otherMixins = {}
1
+ let otherMixins = {};
2
2
 
3
3
  // #ifndef APP-PLUS|| MP-WEIXIN || H5
4
4
  const MIN_DISTANCE = 10;
5
5
  otherMixins = {
6
- data() {
7
- // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
8
- const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
9
- return {
10
- uniShow: false,
11
- left: 0,
12
- buttonShow: 'none',
13
- ani: false,
14
- moveLeft: '',
15
- elClass
16
- }
17
- },
18
- watch: {
19
- show(newVal) {
20
- if (this.autoClose) return
21
- this.openState(newVal)
22
- },
23
- left() {
24
- this.moveLeft = `translateX(${this.left}px)`
25
- },
26
- buttonShow(newVal) {
27
- if (this.autoClose) return
28
- this.openState(newVal)
29
- },
30
- leftOptions() {
31
- this.init()
32
- },
33
- rightOptions() {
34
- this.init()
35
- }
36
- },
37
- mounted() {
38
- this.swipeaction = this.getSwipeAction()
39
- if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
40
- this.swipeaction.children.push(this)
41
- }
42
- this.init()
43
- },
44
- methods: {
45
- init() {
46
- clearTimeout(this.timer)
47
- this.timer = setTimeout(() => {
48
- this.getSelectorQuery()
49
- }, 100)
50
- // 移动距离
51
- this.left = 0
52
- this.x = 0
53
- },
6
+ data() {
7
+ // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
8
+ const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`;
9
+ return {
10
+ uniShow: false,
11
+ left: 0,
12
+ buttonShow: 'none',
13
+ ani: false,
14
+ moveLeft: '',
15
+ elClass,
16
+ };
17
+ },
18
+ watch: {
19
+ show(newVal) {
20
+ if (this.autoClose) return;
21
+ this.openState(newVal);
22
+ },
23
+ left() {
24
+ this.moveLeft = `translateX(${this.left}px)`;
25
+ },
26
+ buttonShow(newVal) {
27
+ if (this.autoClose) return;
28
+ this.openState(newVal);
29
+ },
30
+ leftOptions() {
31
+ this.init();
32
+ },
33
+ rightOptions() {
34
+ this.init();
35
+ },
36
+ },
37
+ mounted() {
38
+ this.swipeaction = this.getSwipeAction();
39
+ if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
40
+ this.swipeaction.children.push(this);
41
+ }
42
+ this.init();
43
+ },
44
+ methods: {
45
+ init() {
46
+ clearTimeout(this.timer);
47
+ this.timer = setTimeout(() => {
48
+ this.getSelectorQuery();
49
+ }, 100);
50
+ // 移动距离
51
+ this.left = 0;
52
+ this.x = 0;
53
+ },
54
54
 
55
- closeSwipe(e) {
56
- if (this.autoClose && this.swipeaction) {
57
- this.swipeaction.closeOther(this)
58
- }
59
- },
60
- appTouchStart(e) {
61
- const {
62
- clientX
63
- } = e.changedTouches[0]
64
- this.clientX = clientX
65
- this.timestamp = new Date().getTime()
66
- },
67
- appTouchEnd(e, index, item, position) {
68
- const {
69
- clientX
70
- } = e.changedTouches[0]
71
- // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
72
- let diff = Math.abs(this.clientX - clientX)
73
- let time = (new Date().getTime()) - this.timestamp
74
- if (diff < 40 && time < 300) {
75
- this.$emit('click', {
76
- content: item,
77
- index,
78
- position
79
- })
80
- }
81
- },
82
- touchstart(e) {
83
- if (this.disabled) return
84
- this.ani = false
85
- this.x = this.left || 0
86
- this.stopTouchStart(e)
87
- this.autoClose && this.closeSwipe()
88
- },
89
- touchmove(e) {
90
- if (this.disabled) return
91
- // 是否可以滑动页面
92
- this.stopTouchMove(e);
93
- if (this.direction !== 'horizontal') {
94
- return;
95
- }
96
- this.move(this.x + this.deltaX)
97
- return false
98
- },
99
- touchend() {
100
- if (this.disabled) return
101
- this.moveDirection(this.left)
102
- },
103
- /**
104
- * 设置移动距离
105
- * @param {Object} value
106
- */
107
- move(value) {
108
- value = value || 0
109
- const leftWidth = this.leftWidth
110
- const rightWidth = this.rightWidth
111
- // 获取可滑动范围
112
- this.left = this.range(value, -rightWidth, leftWidth);
113
- },
55
+ closeSwipe(e) {
56
+ if (this.autoClose && this.swipeaction) {
57
+ this.swipeaction.closeOther(this);
58
+ }
59
+ },
60
+ appTouchStart(e) {
61
+ const { clientX } = e.changedTouches[0];
62
+ this.clientX = clientX;
63
+ this.timestamp = new Date().getTime();
64
+ },
65
+ appTouchEnd(e, index, item, position) {
66
+ const { clientX } = e.changedTouches[0];
67
+ // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
68
+ let diff = Math.abs(this.clientX - clientX);
69
+ let time = new Date().getTime() - this.timestamp;
70
+ if (diff < 40 && time < 300) {
71
+ this.$emit('click', {
72
+ content: item,
73
+ index,
74
+ position,
75
+ });
76
+ }
77
+ },
78
+ touchstart(e) {
79
+ if (this.disabled) return;
80
+ this.ani = false;
81
+ this.x = this.left || 0;
82
+ this.stopTouchStart(e);
83
+ this.autoClose && this.closeSwipe();
84
+ },
85
+ touchmove(e) {
86
+ if (this.disabled) return;
87
+ // 是否可以滑动页面
88
+ this.stopTouchMove(e);
89
+ if (this.direction !== 'horizontal') {
90
+ return;
91
+ }
92
+ this.move(this.x + this.deltaX);
93
+ return false;
94
+ },
95
+ touchend() {
96
+ if (this.disabled) return;
97
+ this.moveDirection(this.left);
98
+ },
99
+ /**
100
+ * 设置移动距离
101
+ * @param {Object} value
102
+ */
103
+ move(value) {
104
+ value = value || 0;
105
+ const leftWidth = this.leftWidth;
106
+ const rightWidth = this.rightWidth;
107
+ // 获取可滑动范围
108
+ this.left = this.range(value, -rightWidth, leftWidth);
109
+ },
114
110
 
115
- /**
116
- * 获取范围
117
- * @param {Object} num
118
- * @param {Object} min
119
- * @param {Object} max
120
- */
121
- range(num, min, max) {
122
- return Math.min(Math.max(num, min), max);
123
- },
124
- /**
125
- * 移动方向判断
126
- * @param {Object} left
127
- * @param {Object} value
128
- */
129
- moveDirection(left) {
130
- const threshold = this.threshold
131
- const isopen = this.isopen || 'none'
132
- const leftWidth = this.leftWidth
133
- const rightWidth = this.rightWidth
134
- if (this.deltaX === 0) {
135
- this.openState('none')
136
- return
137
- }
138
- if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth >
139
- 0 && rightWidth +
140
- left < threshold)) {
141
- // right
142
- this.openState('right')
143
- } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth >
144
- 0 &&
145
- leftWidth - left < threshold)) {
146
- // left
147
- this.openState('left')
148
- } else {
149
- // default
150
- this.openState('none')
151
- }
152
- },
111
+ /**
112
+ * 获取范围
113
+ * @param {Object} num
114
+ * @param {Object} min
115
+ * @param {Object} max
116
+ */
117
+ range(num, min, max) {
118
+ return Math.min(Math.max(num, min), max);
119
+ },
120
+ /**
121
+ * 移动方向判断
122
+ * @param {Object} left
123
+ * @param {Object} value
124
+ */
125
+ moveDirection(left) {
126
+ const threshold = this.threshold;
127
+ const isopen = this.isopen || 'none';
128
+ const leftWidth = this.leftWidth;
129
+ const rightWidth = this.rightWidth;
130
+ if (this.deltaX === 0) {
131
+ this.openState('none');
132
+ return;
133
+ }
134
+ if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth + left < threshold)) {
135
+ // right
136
+ this.openState('right');
137
+ } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && leftWidth - left < threshold)) {
138
+ // left
139
+ this.openState('left');
140
+ } else {
141
+ // default
142
+ this.openState('none');
143
+ }
144
+ },
153
145
 
154
- /**
155
- * 开启状态
156
- * @param {Boolean} type
157
- */
158
- openState(type) {
159
- const leftWidth = this.leftWidth
160
- const rightWidth = this.rightWidth
161
- let left = ''
162
- this.isopen = this.isopen ? this.isopen : 'none'
163
- switch (type) {
164
- case "left":
165
- left = leftWidth
166
- break
167
- case "right":
168
- left = -rightWidth
169
- break
170
- default:
171
- left = 0
172
- }
146
+ /**
147
+ * 开启状态
148
+ * @param {Boolean} type
149
+ */
150
+ openState(type) {
151
+ const leftWidth = this.leftWidth;
152
+ const rightWidth = this.rightWidth;
153
+ let left = '';
154
+ this.isopen = this.isopen ? this.isopen : 'none';
155
+ switch (type) {
156
+ case 'left':
157
+ left = leftWidth;
158
+ break;
159
+ case 'right':
160
+ left = -rightWidth;
161
+ break;
162
+ default:
163
+ left = 0;
164
+ }
173
165
 
166
+ if (this.isopen !== type) {
167
+ this.throttle = true;
168
+ this.$emit('change', type);
169
+ }
174
170
 
175
- if (this.isopen !== type) {
176
- this.throttle = true
177
- this.$emit('change', type)
178
- }
171
+ this.isopen = type;
172
+ // 添加动画类
173
+ this.ani = true;
174
+ this.$nextTick(() => {
175
+ this.move(left);
176
+ });
177
+ // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
178
+ },
179
+ close() {
180
+ this.openState('none');
181
+ },
182
+ getDirection(x, y) {
183
+ if (x > y && x > MIN_DISTANCE) {
184
+ return 'horizontal';
185
+ }
186
+ if (y > x && y > MIN_DISTANCE) {
187
+ return 'vertical';
188
+ }
189
+ return '';
190
+ },
179
191
 
180
- this.isopen = type
181
- // 添加动画类
182
- this.ani = true
183
- this.$nextTick(() => {
184
- this.move(left)
185
- })
186
- // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
187
- },
188
- close() {
189
- this.openState('none')
190
- },
191
- getDirection(x, y) {
192
- if (x > y && x > MIN_DISTANCE) {
193
- return 'horizontal';
194
- }
195
- if (y > x && y > MIN_DISTANCE) {
196
- return 'vertical';
197
- }
198
- return '';
199
- },
192
+ /**
193
+ * 重置滑动状态
194
+ * @param {Object} event
195
+ */
196
+ resetTouchStatus() {
197
+ this.direction = '';
198
+ this.deltaX = 0;
199
+ this.deltaY = 0;
200
+ this.offsetX = 0;
201
+ this.offsetY = 0;
202
+ },
200
203
 
201
- /**
202
- * 重置滑动状态
203
- * @param {Object} event
204
- */
205
- resetTouchStatus() {
206
- this.direction = '';
207
- this.deltaX = 0;
208
- this.deltaY = 0;
209
- this.offsetX = 0;
210
- this.offsetY = 0;
211
- },
204
+ /**
205
+ * 设置滑动开始位置
206
+ * @param {Object} event
207
+ */
208
+ stopTouchStart(event) {
209
+ this.resetTouchStatus();
210
+ const touch = event.touches[0];
211
+ this.startX = touch.clientX;
212
+ this.startY = touch.clientY;
213
+ },
212
214
 
213
- /**
214
- * 设置滑动开始位置
215
- * @param {Object} event
216
- */
217
- stopTouchStart(event) {
218
- this.resetTouchStatus();
219
- const touch = event.touches[0];
220
- this.startX = touch.clientX;
221
- this.startY = touch.clientY;
222
- },
215
+ /**
216
+ * 滑动中,是否禁止打开
217
+ * @param {Object} event
218
+ */
219
+ stopTouchMove(event) {
220
+ const touch = event.touches[0];
221
+ this.deltaX = touch.clientX - this.startX;
222
+ this.deltaY = touch.clientY - this.startY;
223
+ this.offsetX = Math.abs(this.deltaX);
224
+ this.offsetY = Math.abs(this.deltaY);
225
+ this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY);
226
+ },
223
227
 
224
- /**
225
- * 滑动中,是否禁止打开
226
- * @param {Object} event
227
- */
228
- stopTouchMove(event) {
229
- const touch = event.touches[0];
230
- this.deltaX = touch.clientX - this.startX;
231
- this.deltaY = touch.clientY - this.startY;
232
- this.offsetX = Math.abs(this.deltaX);
233
- this.offsetY = Math.abs(this.deltaY);
234
- this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY);
235
- },
236
-
237
- getSelectorQuery() {
238
- const views = uni.createSelectorQuery().in(this)
239
- views
240
- .selectAll('.' + this.elClass)
241
- .boundingClientRect(data => {
242
- if (data.length === 0) return
243
- let show = 'none'
244
- if (this.autoClose) {
245
- show = 'none'
246
- } else {
247
- show = this.show
248
- }
249
- this.leftWidth = data[0].width || 0
250
- this.rightWidth = data[1].width || 0
251
- this.buttonShow = show
252
- })
253
- .exec()
254
- }
255
- }
256
- }
228
+ getSelectorQuery() {
229
+ const views = uni.createSelectorQuery().in(this);
230
+ views
231
+ .selectAll('.' + this.elClass)
232
+ .boundingClientRect((data) => {
233
+ if (data.length === 0) return;
234
+ let show = 'none';
235
+ if (this.autoClose) {
236
+ show = 'none';
237
+ } else {
238
+ show = this.show;
239
+ }
240
+ this.leftWidth = data[0].width || 0;
241
+ this.rightWidth = data[1].width || 0;
242
+ this.buttonShow = show;
243
+ })
244
+ .exec();
245
+ },
246
+ },
247
+ };
257
248
 
258
249
  // #endif
259
250
 
260
- export default otherMixins
251
+ export default otherMixins;
@@ -1,84 +1,79 @@
1
- let mpMixins = {}
2
- let is_pc = null
1
+ let mpMixins = {};
2
+ let is_pc = null;
3
3
  // #ifdef H5
4
- import {
5
- isPC
6
- } from "./isPC"
7
- is_pc = isPC()
4
+ import { isPC } from './isPC';
5
+
6
+ is_pc = isPC();
8
7
  // #endif
9
8
  // #ifdef APP-VUE|| MP-WEIXIN || H5
10
9
 
11
10
  mpMixins = {
12
- data() {
13
- return {
14
- is_show: 'none'
15
- }
16
- },
17
- watch: {
18
- show(newVal) {
19
- this.is_show = this.show
20
- }
21
- },
22
- created() {
23
- this.swipeaction = this.getSwipeAction()
24
- if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
25
- this.swipeaction.children.push(this)
26
- }
27
- },
28
- mounted() {
29
- this.is_show = this.show
30
- },
31
- methods: {
32
- // wxs 中调用
33
- closeSwipe(e) {
34
- if (this.autoClose && this.swipeaction) {
35
- this.swipeaction.closeOther(this)
36
- }
37
- },
11
+ data() {
12
+ return {
13
+ is_show: 'none',
14
+ };
15
+ },
16
+ watch: {
17
+ show(newVal) {
18
+ this.is_show = this.show;
19
+ },
20
+ },
21
+ created() {
22
+ this.swipeaction = this.getSwipeAction();
23
+ if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
24
+ this.swipeaction.children.push(this);
25
+ }
26
+ },
27
+ mounted() {
28
+ this.is_show = this.show;
29
+ },
30
+ methods: {
31
+ // wxs 中调用
32
+ closeSwipe(e) {
33
+ if (this.autoClose && this.swipeaction) {
34
+ this.swipeaction.closeOther(this);
35
+ }
36
+ },
38
37
 
39
- change(e) {
40
- this.$emit('change', e.open)
41
- if (this.is_show !== e.open) {
42
- this.is_show = e.open
43
- }
44
- },
38
+ change(e) {
39
+ this.$emit('change', e.open);
40
+ if (this.is_show !== e.open) {
41
+ this.is_show = e.open;
42
+ }
43
+ },
45
44
 
46
- appTouchStart(e) {
47
- if (is_pc) return
48
- const {
49
- clientX
50
- } = e.changedTouches[0]
51
- this.clientX = clientX
52
- this.timestamp = new Date().getTime()
53
- },
54
- appTouchEnd(e, index, item, position) {
55
- if (is_pc) return
56
- const {
57
- clientX
58
- } = e.changedTouches[0]
59
- // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
60
- let diff = Math.abs(this.clientX - clientX)
61
- let time = (new Date().getTime()) - this.timestamp
62
- if (diff < 40 && time < 300) {
63
- this.$emit('click', {
64
- content: item,
65
- index,
66
- position
67
- })
68
- }
69
- },
70
- onClickForPC(index, item, position) {
71
- if (!is_pc) return
72
- // #ifdef H5
73
- this.$emit('click', {
74
- content: item,
75
- index,
76
- position
77
- })
78
- // #endif
79
- }
80
- }
81
- }
45
+ appTouchStart(e) {
46
+ if (is_pc) return;
47
+ const { clientX } = e.changedTouches[0];
48
+ this.clientX = clientX;
49
+ this.timestamp = new Date().getTime();
50
+ },
51
+ appTouchEnd(e, index, item, position) {
52
+ if (is_pc) return;
53
+ const { clientX } = e.changedTouches[0];
54
+ // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
55
+ let diff = Math.abs(this.clientX - clientX);
56
+ let time = new Date().getTime() - this.timestamp;
57
+ if (diff < 40 && time < 300) {
58
+ this.$emit('click', {
59
+ content: item,
60
+ index,
61
+ position,
62
+ });
63
+ }
64
+ },
65
+ onClickForPC(index, item, position) {
66
+ if (!is_pc) return;
67
+ // #ifdef H5
68
+ this.$emit('click', {
69
+ content: item,
70
+ index,
71
+ position,
72
+ });
73
+ // #endif
74
+ },
75
+ },
76
+ };
82
77
 
83
78
  // #endif
84
- export default mpMixins
79
+ export default mpMixins;