@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.
- package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
- package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
- package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
- package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
- package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
- package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
- package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
- package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
- package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
- package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
- package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
- package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
- package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
- package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
- package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
- package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
- package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
- package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
- package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
- package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
- package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
- package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
- package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
- package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
- package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
- package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
- package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
- package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
- package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
- package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
- package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
- package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
- package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
- package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
- package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
- package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
- package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
- package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
- package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
- package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
- package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
- package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
- package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
- package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
- package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
- package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
- package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
- package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
- package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
- package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
- package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
- package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
- package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
- package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
- package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
- package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
- package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
- package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
- package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
- package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
- package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
- package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
- package/dist/uni/uni-ui/uni-scss/package.json +73 -73
- package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
- package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
- package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
- package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
- package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
- package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
- package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
- package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
- package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
- package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
- package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
- package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
- package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
- package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
- package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
- package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
- package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
- package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
- package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
- package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
- package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
- package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
- package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
- package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
- package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
- package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
- package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
- package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
- package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
- package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
- package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
- package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
- package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
- package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
- package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
- package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
- package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
- package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
- 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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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;
|