vant 2.12.35 → 2.12.39
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/es/calendar/components/Month.js +2 -4
- package/es/calendar/index.js +10 -1
- package/es/datetime-picker/index.js +1 -1
- package/es/datetime-picker/shared.js +25 -3
- package/es/datetime-picker/utils.js +4 -0
- package/es/image-preview/ImagePreview.js +1 -0
- package/es/image-preview/ImagePreviewItem.js +8 -3
- package/es/image-preview/index.js +1 -0
- package/es/index.js +1 -1
- package/es/mixins/touch.js +10 -6
- package/es/nav-bar/index.js +9 -1
- package/es/slider/index.js +23 -4
- package/es/swipe/index.js +2 -8
- package/es/tabbar/index.js +14 -6
- package/es/uploader/index.js +15 -1
- package/lib/calendar/components/Month.js +2 -4
- package/lib/calendar/index.js +10 -1
- package/lib/datetime-picker/index.js +1 -1
- package/lib/datetime-picker/shared.js +25 -3
- package/lib/datetime-picker/utils.js +4 -0
- package/lib/image-preview/ImagePreview.js +1 -0
- package/lib/image-preview/ImagePreviewItem.js +8 -3
- package/lib/image-preview/index.js +1 -0
- package/lib/index.js +1 -1
- package/lib/mixins/touch.js +10 -7
- package/lib/nav-bar/index.js +9 -1
- package/lib/slider/index.js +23 -4
- package/lib/swipe/index.js +2 -8
- package/lib/tabbar/index.js +14 -6
- package/lib/uploader/index.js +15 -1
- package/lib/vant.js +131 -44
- package/lib/vant.min.js +1 -1
- package/package.json +1 -1
- package/types/image-preview.d.ts +1 -0
- package/vetur/attributes.json +202 -198
- package/vetur/tags.json +65 -64
- package/vetur/web-types.json +519 -502
@@ -90,11 +90,9 @@ export default createComponent({
|
|
90
90
|
},
|
91
91
|
methods: {
|
92
92
|
getHeight: function getHeight() {
|
93
|
-
|
94
|
-
this.height = this.$el.getBoundingClientRect().height;
|
95
|
-
}
|
93
|
+
var _this$$el;
|
96
94
|
|
97
|
-
return this.height;
|
95
|
+
return ((_this$$el = this.$el) == null ? void 0 : _this$$el.getBoundingClientRect().height) || 0;
|
98
96
|
},
|
99
97
|
scrollIntoView: function scrollIntoView(body) {
|
100
98
|
var _this$$refs = this.$refs,
|
package/es/calendar/index.js
CHANGED
@@ -98,6 +98,11 @@ export default createComponent({
|
|
98
98
|
}
|
99
99
|
}
|
100
100
|
},
|
101
|
+
inject: {
|
102
|
+
vanPopup: {
|
103
|
+
default: null
|
104
|
+
}
|
105
|
+
},
|
101
106
|
data: function data() {
|
102
107
|
return {
|
103
108
|
subtitle: '',
|
@@ -148,7 +153,11 @@ export default createComponent({
|
|
148
153
|
}
|
149
154
|
},
|
150
155
|
mounted: function mounted() {
|
151
|
-
|
156
|
+
var _this$vanPopup;
|
157
|
+
|
158
|
+
this.init(); // https://github.com/youzan/vant/issues/9845
|
159
|
+
|
160
|
+
(_this$vanPopup = this.vanPopup) == null ? void 0 : _this$vanPopup.$on('opened', this.onScroll);
|
152
161
|
},
|
153
162
|
|
154
163
|
/* istanbul ignore next */
|
@@ -77,10 +77,32 @@ export var TimePickerMixin = {
|
|
77
77
|
});
|
78
78
|
},
|
79
79
|
methods: {
|
80
|
-
// @exposed-api
|
81
80
|
getPicker: function getPicker() {
|
82
81
|
return this.$refs.picker;
|
83
82
|
},
|
83
|
+
// https://github.com/youzan/vant/issues/10013
|
84
|
+
getProxiedPicker: function getProxiedPicker() {
|
85
|
+
var _this4 = this;
|
86
|
+
|
87
|
+
var picker = this.$refs.picker;
|
88
|
+
|
89
|
+
if (picker) {
|
90
|
+
var proxy = function proxy(fn) {
|
91
|
+
return function () {
|
92
|
+
picker[fn].apply(picker, arguments);
|
93
|
+
|
94
|
+
_this4.updateInnerValue();
|
95
|
+
};
|
96
|
+
};
|
97
|
+
|
98
|
+
return _extends({}, picker, {
|
99
|
+
setValues: proxy('setValues'),
|
100
|
+
setIndexes: proxy('setIndexes'),
|
101
|
+
setColumnIndex: proxy('setColumnIndex'),
|
102
|
+
setColumnValue: proxy('setColumnValue')
|
103
|
+
});
|
104
|
+
}
|
105
|
+
},
|
84
106
|
onConfirm: function onConfirm() {
|
85
107
|
this.$emit('input', this.innerValue);
|
86
108
|
this.$emit('confirm', this.innerValue);
|
@@ -90,12 +112,12 @@ export var TimePickerMixin = {
|
|
90
112
|
}
|
91
113
|
},
|
92
114
|
render: function render() {
|
93
|
-
var
|
115
|
+
var _this5 = this;
|
94
116
|
|
95
117
|
var h = arguments[0];
|
96
118
|
var props = {};
|
97
119
|
Object.keys(pickerProps).forEach(function (key) {
|
98
|
-
props[key] =
|
120
|
+
props[key] = _this5[key];
|
99
121
|
});
|
100
122
|
return h(Picker, {
|
101
123
|
"ref": "picker",
|
@@ -114,10 +114,11 @@ export default {
|
|
114
114
|
offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
|
115
115
|
this.touchStart(event);
|
116
116
|
this.touchStartTime = new Date();
|
117
|
+
this.fingerNum = touches.length;
|
117
118
|
this.startMoveX = this.moveX;
|
118
119
|
this.startMoveY = this.moveY;
|
119
|
-
this.moving =
|
120
|
-
this.zooming =
|
120
|
+
this.moving = this.fingerNum === 1 && this.scale !== 1;
|
121
|
+
this.zooming = this.fingerNum === 2 && !offsetX;
|
121
122
|
|
122
123
|
if (this.zooming) {
|
123
124
|
this.startScale = this.scale;
|
@@ -182,13 +183,17 @@ export default {
|
|
182
183
|
checkTap: function checkTap() {
|
183
184
|
var _this = this;
|
184
185
|
|
186
|
+
if (this.fingerNum > 1) {
|
187
|
+
return;
|
188
|
+
}
|
189
|
+
|
185
190
|
var _this$offsetX2 = this.offsetX,
|
186
191
|
offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
|
187
192
|
_this$offsetY = this.offsetY,
|
188
193
|
offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
|
189
194
|
var deltaTime = new Date() - this.touchStartTime;
|
190
195
|
var TAP_TIME = 250;
|
191
|
-
var TAP_OFFSET =
|
196
|
+
var TAP_OFFSET = 5;
|
192
197
|
|
193
198
|
if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
|
194
199
|
if (this.doubleTapTimer) {
|
package/es/index.js
CHANGED
@@ -87,7 +87,7 @@ import Tag from './tag';
|
|
87
87
|
import Toast from './toast';
|
88
88
|
import TreeSelect from './tree-select';
|
89
89
|
import Uploader from './uploader';
|
90
|
-
var version = '2.12.
|
90
|
+
var version = '2.12.39';
|
91
91
|
|
92
92
|
function install(Vue) {
|
93
93
|
var components = [ActionSheet, AddressEdit, AddressList, Area, Badge, Button, Calendar, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, ContactCard, ContactEdit, ContactList, CountDown, Coupon, CouponCell, CouponList, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, GoodsAction, GoodsActionButton, GoodsActionIcon, Grid, GridItem, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, List, Loading, Locale, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Panel, PasswordInput, Picker, Popover, Popup, Progress, PullRefresh, Radio, RadioGroup, Rate, Row, Search, ShareSheet, Sidebar, SidebarItem, Skeleton, Sku, Slider, Step, Stepper, Steps, Sticky, SubmitBar, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, TreeSelect, Uploader];
|
package/es/mixins/touch.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import { on } from '../utils/dom/event';
|
2
|
-
var MIN_DISTANCE = 10;
|
3
2
|
|
4
3
|
function getDirection(x, y) {
|
5
|
-
if (x > y
|
4
|
+
if (x > y) {
|
6
5
|
return 'horizontal';
|
7
6
|
}
|
8
7
|
|
9
|
-
if (y > x
|
8
|
+
if (y > x) {
|
10
9
|
return 'vertical';
|
11
10
|
}
|
12
11
|
|
@@ -26,13 +25,18 @@ export var TouchMixin = {
|
|
26
25
|
this.startY = event.touches[0].clientY;
|
27
26
|
},
|
28
27
|
touchMove: function touchMove(event) {
|
29
|
-
var touch = event.touches[0]; //
|
28
|
+
var touch = event.touches[0]; // safari back will set clientX to negative number
|
30
29
|
|
31
30
|
this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
|
32
31
|
this.deltaY = touch.clientY - this.startY;
|
33
32
|
this.offsetX = Math.abs(this.deltaX);
|
34
|
-
this.offsetY = Math.abs(this.deltaY);
|
35
|
-
|
33
|
+
this.offsetY = Math.abs(this.deltaY); // lock direction when distance is greater than a certain value
|
34
|
+
|
35
|
+
var LOCK_DIRECTION_DISTANCE = 10;
|
36
|
+
|
37
|
+
if (!this.direction || this.offsetX < LOCK_DIRECTION_DISTANCE && this.offsetY < LOCK_DIRECTION_DISTANCE) {
|
38
|
+
this.direction = getDirection(this.offsetX, this.offsetY);
|
39
|
+
}
|
36
40
|
},
|
37
41
|
resetTouchStatus: function resetTouchStatus() {
|
38
42
|
this.direction = '';
|
package/es/nav-bar/index.js
CHANGED
@@ -29,8 +29,16 @@ export default createComponent({
|
|
29
29
|
};
|
30
30
|
},
|
31
31
|
mounted: function mounted() {
|
32
|
+
var _this = this;
|
33
|
+
|
32
34
|
if (this.placeholder && this.fixed) {
|
33
|
-
|
35
|
+
var setHeight = function setHeight() {
|
36
|
+
_this.height = _this.$refs.navBar.getBoundingClientRect().height;
|
37
|
+
};
|
38
|
+
|
39
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
40
|
+
|
41
|
+
setTimeout(setHeight, 100);
|
34
42
|
}
|
35
43
|
},
|
36
44
|
methods: {
|
package/es/slider/index.js
CHANGED
@@ -233,6 +233,7 @@ export default createComponent({
|
|
233
233
|
var renderButton = function renderButton(i) {
|
234
234
|
var map = ['left', 'right'];
|
235
235
|
var isNumber = typeof i === 'number';
|
236
|
+
var current = isNumber ? _this.value[i] : _this.value;
|
236
237
|
|
237
238
|
var getClassName = function getClassName() {
|
238
239
|
if (isNumber) {
|
@@ -250,6 +251,27 @@ export default createComponent({
|
|
250
251
|
return "wrapper";
|
251
252
|
};
|
252
253
|
|
254
|
+
var renderButtonContent = function renderButtonContent() {
|
255
|
+
if (isNumber) {
|
256
|
+
var slot = _this.slots(i === 0 ? 'left-button' : 'right-button', {
|
257
|
+
value: current
|
258
|
+
});
|
259
|
+
|
260
|
+
if (slot) {
|
261
|
+
return slot;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
if (_this.slots('button')) {
|
266
|
+
return _this.slots('button');
|
267
|
+
}
|
268
|
+
|
269
|
+
return h("div", {
|
270
|
+
"class": bem('button'),
|
271
|
+
"style": _this.buttonStyle
|
272
|
+
});
|
273
|
+
};
|
274
|
+
|
253
275
|
return h("div", {
|
254
276
|
"ref": getRefName(),
|
255
277
|
"attrs": {
|
@@ -272,10 +294,7 @@ export default createComponent({
|
|
272
294
|
return e.stopPropagation();
|
273
295
|
}
|
274
296
|
}
|
275
|
-
}, [
|
276
|
-
"class": bem('button'),
|
277
|
-
"style": _this.buttonStyle
|
278
|
-
})]);
|
297
|
+
}, [renderButtonContent()]);
|
279
298
|
};
|
280
299
|
|
281
300
|
return h("div", {
|
package/es/swipe/index.js
CHANGED
@@ -181,16 +181,10 @@ export default createComponent({
|
|
181
181
|
},
|
182
182
|
onTouchMove: function onTouchMove(event) {
|
183
183
|
if (!this.touchable || !this.swiping) return;
|
184
|
-
this.touchMove(event);
|
185
|
-
// avoid affecting the parent components
|
186
|
-
|
187
|
-
var shouldPrevent = this.isCorrectDirection || this.offsetY > this.offsetX === this.vertical;
|
188
|
-
|
189
|
-
if (shouldPrevent) {
|
190
|
-
preventDefault(event, this.stopPropagation);
|
191
|
-
}
|
184
|
+
this.touchMove(event);
|
192
185
|
|
193
186
|
if (this.isCorrectDirection) {
|
187
|
+
preventDefault(event, this.stopPropagation);
|
194
188
|
this.move({
|
195
189
|
offset: this.delta
|
196
190
|
});
|
package/es/tabbar/index.js
CHANGED
@@ -53,28 +53,36 @@ export default createComponent({
|
|
53
53
|
children: 'setActiveItem'
|
54
54
|
},
|
55
55
|
mounted: function mounted() {
|
56
|
+
var _this = this;
|
57
|
+
|
56
58
|
if (this.placeholder && this.fixed) {
|
57
|
-
|
59
|
+
var setHeight = function setHeight() {
|
60
|
+
_this.height = _this.$refs.tabbar.getBoundingClientRect().height;
|
61
|
+
};
|
62
|
+
|
63
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
64
|
+
|
65
|
+
setTimeout(setHeight, 100);
|
58
66
|
}
|
59
67
|
},
|
60
68
|
methods: {
|
61
69
|
setActiveItem: function setActiveItem() {
|
62
|
-
var
|
70
|
+
var _this2 = this;
|
63
71
|
|
64
72
|
this.children.forEach(function (item, index) {
|
65
|
-
item.nameMatched = (item.name || index) ===
|
73
|
+
item.nameMatched = (item.name || index) === _this2.value;
|
66
74
|
});
|
67
75
|
},
|
68
76
|
triggerChange: function triggerChange(active, afterChange) {
|
69
|
-
var
|
77
|
+
var _this3 = this;
|
70
78
|
|
71
79
|
callInterceptor({
|
72
80
|
interceptor: this.beforeChange,
|
73
81
|
args: [active],
|
74
82
|
done: function done() {
|
75
|
-
|
83
|
+
_this3.$emit('input', active);
|
76
84
|
|
77
|
-
|
85
|
+
_this3.$emit('change', active);
|
78
86
|
|
79
87
|
afterChange();
|
80
88
|
}
|
package/es/uploader/index.js
CHANGED
@@ -90,6 +90,14 @@ export default createComponent({
|
|
90
90
|
return this.fileList;
|
91
91
|
}
|
92
92
|
},
|
93
|
+
created: function created() {
|
94
|
+
this.urls = [];
|
95
|
+
},
|
96
|
+
beforeDestroy: function beforeDestroy() {
|
97
|
+
this.urls.forEach(function (url) {
|
98
|
+
return URL.revokeObjectURL(url);
|
99
|
+
});
|
100
|
+
},
|
93
101
|
methods: {
|
94
102
|
getDetail: function getDetail(index) {
|
95
103
|
if (index === void 0) {
|
@@ -268,7 +276,13 @@ export default createComponent({
|
|
268
276
|
return isImageFile(item);
|
269
277
|
});
|
270
278
|
var imageContents = imageFiles.map(function (item) {
|
271
|
-
|
279
|
+
if (item.file && !item.url) {
|
280
|
+
item.url = URL.createObjectURL(item.file);
|
281
|
+
|
282
|
+
_this5.urls.push(item.url);
|
283
|
+
}
|
284
|
+
|
285
|
+
return item.url;
|
272
286
|
});
|
273
287
|
this.imagePreview = ImagePreview(_extends({
|
274
288
|
images: imageContents,
|
@@ -98,11 +98,9 @@ var _default = createComponent({
|
|
98
98
|
},
|
99
99
|
methods: {
|
100
100
|
getHeight: function getHeight() {
|
101
|
-
|
102
|
-
this.height = this.$el.getBoundingClientRect().height;
|
103
|
-
}
|
101
|
+
var _this$$el;
|
104
102
|
|
105
|
-
return this.height;
|
103
|
+
return ((_this$$el = this.$el) == null ? void 0 : _this$$el.getBoundingClientRect().height) || 0;
|
106
104
|
},
|
107
105
|
scrollIntoView: function scrollIntoView(body) {
|
108
106
|
var _this$$refs = this.$refs,
|
package/lib/calendar/index.js
CHANGED
@@ -114,6 +114,11 @@ var _default2 = (0, _utils.createComponent)({
|
|
114
114
|
}
|
115
115
|
}
|
116
116
|
},
|
117
|
+
inject: {
|
118
|
+
vanPopup: {
|
119
|
+
default: null
|
120
|
+
}
|
121
|
+
},
|
117
122
|
data: function data() {
|
118
123
|
return {
|
119
124
|
subtitle: '',
|
@@ -164,7 +169,11 @@ var _default2 = (0, _utils.createComponent)({
|
|
164
169
|
}
|
165
170
|
},
|
166
171
|
mounted: function mounted() {
|
167
|
-
|
172
|
+
var _this$vanPopup;
|
173
|
+
|
174
|
+
this.init(); // https://github.com/youzan/vant/issues/9845
|
175
|
+
|
176
|
+
(_this$vanPopup = this.vanPopup) == null ? void 0 : _this$vanPopup.$on('opened', this.onScroll);
|
168
177
|
},
|
169
178
|
|
170
179
|
/* istanbul ignore next */
|
@@ -90,10 +90,32 @@ var TimePickerMixin = {
|
|
90
90
|
});
|
91
91
|
},
|
92
92
|
methods: {
|
93
|
-
// @exposed-api
|
94
93
|
getPicker: function getPicker() {
|
95
94
|
return this.$refs.picker;
|
96
95
|
},
|
96
|
+
// https://github.com/youzan/vant/issues/10013
|
97
|
+
getProxiedPicker: function getProxiedPicker() {
|
98
|
+
var _this4 = this;
|
99
|
+
|
100
|
+
var picker = this.$refs.picker;
|
101
|
+
|
102
|
+
if (picker) {
|
103
|
+
var proxy = function proxy(fn) {
|
104
|
+
return function () {
|
105
|
+
picker[fn].apply(picker, arguments);
|
106
|
+
|
107
|
+
_this4.updateInnerValue();
|
108
|
+
};
|
109
|
+
};
|
110
|
+
|
111
|
+
return (0, _extends2.default)({}, picker, {
|
112
|
+
setValues: proxy('setValues'),
|
113
|
+
setIndexes: proxy('setIndexes'),
|
114
|
+
setColumnIndex: proxy('setColumnIndex'),
|
115
|
+
setColumnValue: proxy('setColumnValue')
|
116
|
+
});
|
117
|
+
}
|
118
|
+
},
|
97
119
|
onConfirm: function onConfirm() {
|
98
120
|
this.$emit('input', this.innerValue);
|
99
121
|
this.$emit('confirm', this.innerValue);
|
@@ -103,12 +125,12 @@ var TimePickerMixin = {
|
|
103
125
|
}
|
104
126
|
},
|
105
127
|
render: function render() {
|
106
|
-
var
|
128
|
+
var _this5 = this;
|
107
129
|
|
108
130
|
var h = arguments[0];
|
109
131
|
var props = {};
|
110
132
|
Object.keys(_shared.pickerProps).forEach(function (key) {
|
111
|
-
props[key] =
|
133
|
+
props[key] = _this5[key];
|
112
134
|
});
|
113
135
|
return h(_picker.default, {
|
114
136
|
"ref": "picker",
|
@@ -127,10 +127,11 @@ var _default = {
|
|
127
127
|
offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
|
128
128
|
this.touchStart(event);
|
129
129
|
this.touchStartTime = new Date();
|
130
|
+
this.fingerNum = touches.length;
|
130
131
|
this.startMoveX = this.moveX;
|
131
132
|
this.startMoveY = this.moveY;
|
132
|
-
this.moving =
|
133
|
-
this.zooming =
|
133
|
+
this.moving = this.fingerNum === 1 && this.scale !== 1;
|
134
|
+
this.zooming = this.fingerNum === 2 && !offsetX;
|
134
135
|
|
135
136
|
if (this.zooming) {
|
136
137
|
this.startScale = this.scale;
|
@@ -195,13 +196,17 @@ var _default = {
|
|
195
196
|
checkTap: function checkTap() {
|
196
197
|
var _this = this;
|
197
198
|
|
199
|
+
if (this.fingerNum > 1) {
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
|
198
203
|
var _this$offsetX2 = this.offsetX,
|
199
204
|
offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
|
200
205
|
_this$offsetY = this.offsetY,
|
201
206
|
offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
|
202
207
|
var deltaTime = new Date() - this.touchStartTime;
|
203
208
|
var TAP_TIME = 250;
|
204
|
-
var TAP_OFFSET =
|
209
|
+
var TAP_OFFSET = 5;
|
205
210
|
|
206
211
|
if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
|
207
212
|
if (this.doubleTapTimer) {
|
package/lib/index.js
CHANGED
@@ -361,7 +361,7 @@ exports.TreeSelect = _treeSelect.default;
|
|
361
361
|
var _uploader = _interopRequireDefault(require("./uploader"));
|
362
362
|
|
363
363
|
exports.Uploader = _uploader.default;
|
364
|
-
var version = '2.12.
|
364
|
+
var version = '2.12.39';
|
365
365
|
exports.version = version;
|
366
366
|
|
367
367
|
function install(Vue) {
|
package/lib/mixins/touch.js
CHANGED
@@ -5,14 +5,12 @@ exports.TouchMixin = void 0;
|
|
5
5
|
|
6
6
|
var _event = require("../utils/dom/event");
|
7
7
|
|
8
|
-
var MIN_DISTANCE = 10;
|
9
|
-
|
10
8
|
function getDirection(x, y) {
|
11
|
-
if (x > y
|
9
|
+
if (x > y) {
|
12
10
|
return 'horizontal';
|
13
11
|
}
|
14
12
|
|
15
|
-
if (y > x
|
13
|
+
if (y > x) {
|
16
14
|
return 'vertical';
|
17
15
|
}
|
18
16
|
|
@@ -32,13 +30,18 @@ var TouchMixin = {
|
|
32
30
|
this.startY = event.touches[0].clientY;
|
33
31
|
},
|
34
32
|
touchMove: function touchMove(event) {
|
35
|
-
var touch = event.touches[0]; //
|
33
|
+
var touch = event.touches[0]; // safari back will set clientX to negative number
|
36
34
|
|
37
35
|
this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
|
38
36
|
this.deltaY = touch.clientY - this.startY;
|
39
37
|
this.offsetX = Math.abs(this.deltaX);
|
40
|
-
this.offsetY = Math.abs(this.deltaY);
|
41
|
-
|
38
|
+
this.offsetY = Math.abs(this.deltaY); // lock direction when distance is greater than a certain value
|
39
|
+
|
40
|
+
var LOCK_DIRECTION_DISTANCE = 10;
|
41
|
+
|
42
|
+
if (!this.direction || this.offsetX < LOCK_DIRECTION_DISTANCE && this.offsetY < LOCK_DIRECTION_DISTANCE) {
|
43
|
+
this.direction = getDirection(this.offsetX, this.offsetY);
|
44
|
+
}
|
42
45
|
},
|
43
46
|
resetTouchStatus: function resetTouchStatus() {
|
44
47
|
this.direction = '';
|
package/lib/nav-bar/index.js
CHANGED
@@ -38,8 +38,16 @@ var _default = createComponent({
|
|
38
38
|
};
|
39
39
|
},
|
40
40
|
mounted: function mounted() {
|
41
|
+
var _this = this;
|
42
|
+
|
41
43
|
if (this.placeholder && this.fixed) {
|
42
|
-
|
44
|
+
var setHeight = function setHeight() {
|
45
|
+
_this.height = _this.$refs.navBar.getBoundingClientRect().height;
|
46
|
+
};
|
47
|
+
|
48
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
49
|
+
|
50
|
+
setTimeout(setHeight, 100);
|
43
51
|
}
|
44
52
|
},
|
45
53
|
methods: {
|
package/lib/slider/index.js
CHANGED
@@ -243,6 +243,7 @@ var _default = createComponent({
|
|
243
243
|
var renderButton = function renderButton(i) {
|
244
244
|
var map = ['left', 'right'];
|
245
245
|
var isNumber = typeof i === 'number';
|
246
|
+
var current = isNumber ? _this.value[i] : _this.value;
|
246
247
|
|
247
248
|
var getClassName = function getClassName() {
|
248
249
|
if (isNumber) {
|
@@ -260,6 +261,27 @@ var _default = createComponent({
|
|
260
261
|
return "wrapper";
|
261
262
|
};
|
262
263
|
|
264
|
+
var renderButtonContent = function renderButtonContent() {
|
265
|
+
if (isNumber) {
|
266
|
+
var slot = _this.slots(i === 0 ? 'left-button' : 'right-button', {
|
267
|
+
value: current
|
268
|
+
});
|
269
|
+
|
270
|
+
if (slot) {
|
271
|
+
return slot;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
if (_this.slots('button')) {
|
276
|
+
return _this.slots('button');
|
277
|
+
}
|
278
|
+
|
279
|
+
return h("div", {
|
280
|
+
"class": bem('button'),
|
281
|
+
"style": _this.buttonStyle
|
282
|
+
});
|
283
|
+
};
|
284
|
+
|
263
285
|
return h("div", {
|
264
286
|
"ref": getRefName(),
|
265
287
|
"attrs": {
|
@@ -282,10 +304,7 @@ var _default = createComponent({
|
|
282
304
|
return e.stopPropagation();
|
283
305
|
}
|
284
306
|
}
|
285
|
-
}, [
|
286
|
-
"class": bem('button'),
|
287
|
-
"style": _this.buttonStyle
|
288
|
-
})]);
|
307
|
+
}, [renderButtonContent()]);
|
289
308
|
};
|
290
309
|
|
291
310
|
return h("div", {
|
package/lib/swipe/index.js
CHANGED
@@ -193,16 +193,10 @@ var _default = createComponent({
|
|
193
193
|
},
|
194
194
|
onTouchMove: function onTouchMove(event) {
|
195
195
|
if (!this.touchable || !this.swiping) return;
|
196
|
-
this.touchMove(event);
|
197
|
-
// avoid affecting the parent components
|
198
|
-
|
199
|
-
var shouldPrevent = this.isCorrectDirection || this.offsetY > this.offsetX === this.vertical;
|
200
|
-
|
201
|
-
if (shouldPrevent) {
|
202
|
-
(0, _event.preventDefault)(event, this.stopPropagation);
|
203
|
-
}
|
196
|
+
this.touchMove(event);
|
204
197
|
|
205
198
|
if (this.isCorrectDirection) {
|
199
|
+
(0, _event.preventDefault)(event, this.stopPropagation);
|
206
200
|
this.move({
|
207
201
|
offset: this.delta
|
208
202
|
});
|