vant 2.12.38 → 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.
@@ -1,5 +1,9 @@
1
1
  import { isNaN } from '../utils/validate/number';
2
2
  export function times(n, iteratee) {
3
+ if (n < 0) {
4
+ return [];
5
+ }
6
+
3
7
  var index = -1;
4
8
  var result = Array(n);
5
9
 
@@ -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 = touches.length === 1 && this.scale !== 1;
120
- this.zooming = touches.length === 2 && !offsetX;
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 = 10;
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.38';
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];
@@ -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
- this.height = this.$refs.navBar.getBoundingClientRect().height;
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: {
@@ -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
- this.height = this.$refs.tabbar.getBoundingClientRect().height;
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 _this = this;
70
+ var _this2 = this;
63
71
 
64
72
  this.children.forEach(function (item, index) {
65
- item.nameMatched = (item.name || index) === _this.value;
73
+ item.nameMatched = (item.name || index) === _this2.value;
66
74
  });
67
75
  },
68
76
  triggerChange: function triggerChange(active, afterChange) {
69
- var _this2 = this;
77
+ var _this3 = this;
70
78
 
71
79
  callInterceptor({
72
80
  interceptor: this.beforeChange,
73
81
  args: [active],
74
82
  done: function done() {
75
- _this2.$emit('input', active);
83
+ _this3.$emit('input', active);
76
84
 
77
- _this2.$emit('change', active);
85
+ _this3.$emit('change', active);
78
86
 
79
87
  afterChange();
80
88
  }
@@ -8,6 +8,10 @@ exports.getMonthEndDay = getMonthEndDay;
8
8
  var _number = require("../utils/validate/number");
9
9
 
10
10
  function times(n, iteratee) {
11
+ if (n < 0) {
12
+ return [];
13
+ }
14
+
11
15
  var index = -1;
12
16
  var result = Array(n);
13
17
 
@@ -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 = touches.length === 1 && this.scale !== 1;
133
- this.zooming = touches.length === 2 && !offsetX;
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 = 10;
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.38';
364
+ var version = '2.12.39';
365
365
  exports.version = version;
366
366
 
367
367
  function install(Vue) {
@@ -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
- this.height = this.$refs.navBar.getBoundingClientRect().height;
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: {
@@ -61,28 +61,36 @@ var _default = createComponent({
61
61
  children: 'setActiveItem'
62
62
  },
63
63
  mounted: function mounted() {
64
+ var _this = this;
65
+
64
66
  if (this.placeholder && this.fixed) {
65
- this.height = this.$refs.tabbar.getBoundingClientRect().height;
67
+ var setHeight = function setHeight() {
68
+ _this.height = _this.$refs.tabbar.getBoundingClientRect().height;
69
+ };
70
+
71
+ setHeight(); // https://github.com/youzan/vant/issues/10131
72
+
73
+ setTimeout(setHeight, 100);
66
74
  }
67
75
  },
68
76
  methods: {
69
77
  setActiveItem: function setActiveItem() {
70
- var _this = this;
78
+ var _this2 = this;
71
79
 
72
80
  this.children.forEach(function (item, index) {
73
- item.nameMatched = (item.name || index) === _this.value;
81
+ item.nameMatched = (item.name || index) === _this2.value;
74
82
  });
75
83
  },
76
84
  triggerChange: function triggerChange(active, afterChange) {
77
- var _this2 = this;
85
+ var _this3 = this;
78
86
 
79
87
  (0, _interceptor.callInterceptor)({
80
88
  interceptor: this.beforeChange,
81
89
  args: [active],
82
90
  done: function done() {
83
- _this2.$emit('input', active);
91
+ _this3.$emit('input', active);
84
92
 
85
- _this2.$emit('change', active);
93
+ _this3.$emit('change', active);
86
94
 
87
95
  afterChange();
88
96
  }
package/lib/vant.js CHANGED
@@ -6561,6 +6561,10 @@ function copyDates(dates) {
6561
6561
  // CONCATENATED MODULE: ./es/datetime-picker/utils.js
6562
6562
 
6563
6563
  function times(n, iteratee) {
6564
+ if (n < 0) {
6565
+ return [];
6566
+ }
6567
+
6564
6568
  var index = -1;
6565
6569
  var result = Array(n);
6566
6570
 
@@ -13265,10 +13269,11 @@ function getDistance(touches) {
13265
13269
  offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
13266
13270
  this.touchStart(event);
13267
13271
  this.touchStartTime = new Date();
13272
+ this.fingerNum = touches.length;
13268
13273
  this.startMoveX = this.moveX;
13269
13274
  this.startMoveY = this.moveY;
13270
- this.moving = touches.length === 1 && this.scale !== 1;
13271
- this.zooming = touches.length === 2 && !offsetX;
13275
+ this.moving = this.fingerNum === 1 && this.scale !== 1;
13276
+ this.zooming = this.fingerNum === 2 && !offsetX;
13272
13277
 
13273
13278
  if (this.zooming) {
13274
13279
  this.startScale = this.scale;
@@ -13333,13 +13338,17 @@ function getDistance(touches) {
13333
13338
  checkTap: function checkTap() {
13334
13339
  var _this = this;
13335
13340
 
13341
+ if (this.fingerNum > 1) {
13342
+ return;
13343
+ }
13344
+
13336
13345
  var _this$offsetX2 = this.offsetX,
13337
13346
  offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
13338
13347
  _this$offsetY = this.offsetY,
13339
13348
  offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
13340
13349
  var deltaTime = new Date() - this.touchStartTime;
13341
13350
  var TAP_TIME = 250;
13342
- var TAP_OFFSET = 10;
13351
+ var TAP_OFFSET = 5;
13343
13352
 
13344
13353
  if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
13345
13354
  if (this.doubleTapTimer) {
@@ -14244,8 +14253,16 @@ var nav_bar_createNamespace = Object(create["a" /* createNamespace */])('nav-bar
14244
14253
  };
14245
14254
  },
14246
14255
  mounted: function mounted() {
14256
+ var _this = this;
14257
+
14247
14258
  if (this.placeholder && this.fixed) {
14248
- this.height = this.$refs.navBar.getBoundingClientRect().height;
14259
+ var setHeight = function setHeight() {
14260
+ _this.height = _this.$refs.navBar.getBoundingClientRect().height;
14261
+ };
14262
+
14263
+ setHeight(); // https://github.com/youzan/vant/issues/10131
14264
+
14265
+ setTimeout(setHeight, 100);
14249
14266
  }
14250
14267
  },
14251
14268
  methods: {
@@ -21785,28 +21802,36 @@ var tabbar_createNamespace = Object(create["a" /* createNamespace */])('tabbar')
21785
21802
  children: 'setActiveItem'
21786
21803
  },
21787
21804
  mounted: function mounted() {
21805
+ var _this = this;
21806
+
21788
21807
  if (this.placeholder && this.fixed) {
21789
- this.height = this.$refs.tabbar.getBoundingClientRect().height;
21808
+ var setHeight = function setHeight() {
21809
+ _this.height = _this.$refs.tabbar.getBoundingClientRect().height;
21810
+ };
21811
+
21812
+ setHeight(); // https://github.com/youzan/vant/issues/10131
21813
+
21814
+ setTimeout(setHeight, 100);
21790
21815
  }
21791
21816
  },
21792
21817
  methods: {
21793
21818
  setActiveItem: function setActiveItem() {
21794
- var _this = this;
21819
+ var _this2 = this;
21795
21820
 
21796
21821
  this.children.forEach(function (item, index) {
21797
- item.nameMatched = (item.name || index) === _this.value;
21822
+ item.nameMatched = (item.name || index) === _this2.value;
21798
21823
  });
21799
21824
  },
21800
21825
  triggerChange: function triggerChange(active, afterChange) {
21801
- var _this2 = this;
21826
+ var _this3 = this;
21802
21827
 
21803
21828
  callInterceptor({
21804
21829
  interceptor: this.beforeChange,
21805
21830
  args: [active],
21806
21831
  done: function done() {
21807
- _this2.$emit('input', active);
21832
+ _this3.$emit('input', active);
21808
21833
 
21809
- _this2.$emit('change', active);
21834
+ _this3.$emit('change', active);
21810
21835
 
21811
21836
  afterChange();
21812
21837
  }
@@ -22190,7 +22215,7 @@ TreeSelect.props = {
22190
22215
 
22191
22216
 
22192
22217
 
22193
- var version = '2.12.38';
22218
+ var version = '2.12.39';
22194
22219
 
22195
22220
  function install(Vue) {
22196
22221
  var components = [action_sheet, address_edit, address_list, es_area, badge, es_button, calendar, card, cascader, cell, cell_group, es_checkbox, checkbox_group, circle, col, collapse, collapse_item, contact_card, contact_edit, contact_list, count_down, es_coupon, coupon_cell, coupon_list, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, es_form, goods_action, goods_action_button, goods_action_icon, grid, grid_item, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, es_list, es_loading, locale["a" /* default */], nav_bar, notice_bar, notify, number_keyboard, es_overlay, pagination, panel, password_input, es_picker, popover, popup, es_progress, pull_refresh, es_radio, radio_group, es_rate, row, search, share_sheet, sidebar, sidebar_item, skeleton, es_sku, slider, es_step, stepper, steps, es_sticky, submit_bar, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, tabs, es_tag, es_toast, tree_select, uploader];