vant 2.12.31 → 2.12.34
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/README.md +3 -2
- package/README.zh-CN.md +2 -1
- package/es/datetime-picker/TimePicker.js +3 -0
- package/es/field/index.js +5 -3
- package/es/index.js +1 -1
- package/es/notice-bar/index.js +28 -30
- package/es/picker/PickerColumn.js +64 -15
- package/es/swipe/index.js +8 -2
- package/es/switch/index.css +1 -1
- package/es/switch/index.less +2 -0
- package/es/tabbar/index.js +12 -12
- package/es/tabbar-item/index.js +22 -11
- package/lib/datetime-picker/TimePicker.js +3 -0
- package/lib/field/index.js +5 -3
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/notice-bar/index.js +28 -30
- package/lib/picker/PickerColumn.js +64 -12
- package/lib/swipe/index.js +8 -2
- package/lib/switch/index.css +1 -1
- package/lib/switch/index.less +2 -0
- package/lib/tabbar/index.js +13 -13
- package/lib/tabbar-item/index.js +22 -11
- package/lib/vant.js +143 -74
- package/lib/vant.min.js +1 -1
- package/package.json +1 -1
- package/vetur/attributes.json +47 -47
- package/vetur/tags.json +19 -19
- package/vetur/web-types.json +173 -173
package/README.md
CHANGED
@@ -87,11 +87,12 @@ Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3).
|
|
87
87
|
|
88
88
|
| Project | Description |
|
89
89
|
| --- | --- |
|
90
|
-
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components
|
90
|
+
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components based on Vant |
|
91
91
|
| [mxdi9i7/vant-react](https://github.com/mxdi9i7/vant-react) | Mobile UI Components built on React and TS, inspired by Vant |
|
92
92
|
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
|
93
93
|
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
|
94
|
-
| [vant-theme](https://github.com/Aisen60/vant-theme) |
|
94
|
+
| [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI |
|
95
|
+
| [@antmjs/vantui](https://github.com/antmjs/vantui) | Mobile UI Components based on Vant, supporting Taro and React |
|
95
96
|
|
96
97
|
## Links
|
97
98
|
|
package/README.zh-CN.md
CHANGED
@@ -96,11 +96,12 @@ Vant 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致
|
|
96
96
|
|
97
97
|
| 项目 | 描述 |
|
98
98
|
| --- | --- |
|
99
|
-
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React
|
99
|
+
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 移动端组件库 |
|
100
100
|
| [mxdi9i7/vant-react](https://github.com/mxdi9i7/vant-react) | 基于 React 和 TS 构建的移动端组件库 |
|
101
101
|
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 |
|
102
102
|
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 |
|
103
103
|
| [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 |
|
104
|
+
| [@antmjs/vantui](https://github.com/antmjs/vantui) | 基于 Vant Weapp 开发的多端组件库,同时支持 Taro 和 React |
|
104
105
|
|
105
106
|
## 链接
|
106
107
|
|
@@ -114,6 +114,9 @@ export default createComponent({
|
|
114
114
|
this.updateInnerValue();
|
115
115
|
this.$nextTick(function () {
|
116
116
|
_this2.$nextTick(function () {
|
117
|
+
// https://github.com/youzan/vant/issues/9775
|
118
|
+
_this2.updateInnerValue();
|
119
|
+
|
117
120
|
_this2.$emit('change', picker);
|
118
121
|
});
|
119
122
|
});
|
package/es/field/index.js
CHANGED
@@ -339,13 +339,15 @@ export default createComponent({
|
|
339
339
|
|
340
340
|
/* istanbul ignore if */
|
341
341
|
|
342
|
-
|
343
|
-
|
344
|
-
if (readonly) {
|
342
|
+
if (this.getProp('readonly')) {
|
345
343
|
this.blur();
|
346
344
|
}
|
347
345
|
},
|
348
346
|
onBlur: function onBlur(event) {
|
347
|
+
if (this.getProp('readonly')) {
|
348
|
+
return;
|
349
|
+
}
|
350
|
+
|
349
351
|
this.focused = false;
|
350
352
|
this.updateValue(this.value, 'onBlur');
|
351
353
|
this.$emit('blur', event);
|
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.34';
|
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/notice-bar/index.js
CHANGED
@@ -11,7 +11,7 @@ export default createComponent({
|
|
11
11
|
mixins: [BindEventMixin(function (bind) {
|
12
12
|
// fix cache issues with forwards and back history in safari
|
13
13
|
// see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
|
14
|
-
bind(window, 'pageshow', this.
|
14
|
+
bind(window, 'pageshow', this.reset);
|
15
15
|
})],
|
16
16
|
inject: {
|
17
17
|
vanPopup: {
|
@@ -48,24 +48,20 @@ export default createComponent({
|
|
48
48
|
};
|
49
49
|
},
|
50
50
|
watch: {
|
51
|
-
scrollable: '
|
51
|
+
scrollable: 'reset',
|
52
52
|
text: {
|
53
|
-
handler: '
|
53
|
+
handler: 'reset',
|
54
54
|
immediate: true
|
55
55
|
}
|
56
56
|
},
|
57
57
|
created: function created() {
|
58
|
-
var _this = this;
|
59
|
-
|
60
58
|
// https://github.com/youzan/vant/issues/8634
|
61
59
|
if (this.vanPopup) {
|
62
|
-
this.vanPopup.onReopen(
|
63
|
-
_this.start();
|
64
|
-
});
|
60
|
+
this.vanPopup.onReopen(this.reset);
|
65
61
|
}
|
66
62
|
},
|
67
63
|
activated: function activated() {
|
68
|
-
this.
|
64
|
+
this.reset();
|
69
65
|
},
|
70
66
|
methods: {
|
71
67
|
onClickIcon: function onClickIcon(event) {
|
@@ -75,7 +71,7 @@ export default createComponent({
|
|
75
71
|
}
|
76
72
|
},
|
77
73
|
onTransitionEnd: function onTransitionEnd() {
|
78
|
-
var
|
74
|
+
var _this = this;
|
79
75
|
|
80
76
|
this.offset = this.wrapWidth;
|
81
77
|
this.duration = 0; // wait for Vue to render offset
|
@@ -84,50 +80,52 @@ export default createComponent({
|
|
84
80
|
raf(function () {
|
85
81
|
// use double raf to ensure animation can start
|
86
82
|
doubleRaf(function () {
|
87
|
-
|
88
|
-
|
83
|
+
_this.offset = -_this.contentWidth;
|
84
|
+
_this.duration = (_this.contentWidth + _this.wrapWidth) / _this.speed;
|
89
85
|
|
90
|
-
|
86
|
+
_this.$emit('replay');
|
91
87
|
});
|
92
88
|
});
|
93
89
|
},
|
90
|
+
// not an exposed-api, but may used by some users
|
91
|
+
start: function start() {
|
92
|
+
this.reset();
|
93
|
+
},
|
94
|
+
// @exposed-api
|
94
95
|
reset: function reset() {
|
96
|
+
var _this2 = this;
|
97
|
+
|
98
|
+
var delay = isDef(this.delay) ? this.delay * 1000 : 0;
|
95
99
|
this.offset = 0;
|
96
100
|
this.duration = 0;
|
97
101
|
this.wrapWidth = 0;
|
98
102
|
this.contentWidth = 0;
|
99
|
-
},
|
100
|
-
start: function start() {
|
101
|
-
var _this3 = this;
|
102
|
-
|
103
|
-
var delay = isDef(this.delay) ? this.delay * 1000 : 0;
|
104
|
-
this.reset();
|
105
103
|
clearTimeout(this.startTimer);
|
106
104
|
this.startTimer = setTimeout(function () {
|
107
|
-
var
|
108
|
-
wrap =
|
109
|
-
content =
|
105
|
+
var _this2$$refs = _this2.$refs,
|
106
|
+
wrap = _this2$$refs.wrap,
|
107
|
+
content = _this2$$refs.content;
|
110
108
|
|
111
|
-
if (!wrap || !content ||
|
109
|
+
if (!wrap || !content || _this2.scrollable === false) {
|
112
110
|
return;
|
113
111
|
}
|
114
112
|
|
115
113
|
var wrapWidth = wrap.getBoundingClientRect().width;
|
116
114
|
var contentWidth = content.getBoundingClientRect().width;
|
117
115
|
|
118
|
-
if (
|
116
|
+
if (_this2.scrollable || contentWidth > wrapWidth) {
|
119
117
|
doubleRaf(function () {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
_this2.offset = -contentWidth;
|
119
|
+
_this2.duration = contentWidth / _this2.speed;
|
120
|
+
_this2.wrapWidth = wrapWidth;
|
121
|
+
_this2.contentWidth = contentWidth;
|
124
122
|
});
|
125
123
|
}
|
126
124
|
}, delay);
|
127
125
|
}
|
128
126
|
},
|
129
127
|
render: function render() {
|
130
|
-
var
|
128
|
+
var _this3 = this;
|
131
129
|
|
132
130
|
var h = arguments[0];
|
133
131
|
var slots = this.slots,
|
@@ -202,7 +200,7 @@ export default createComponent({
|
|
202
200
|
"style": barStyle,
|
203
201
|
"on": {
|
204
202
|
"click": function click(event) {
|
205
|
-
|
203
|
+
_this3.$emit('click', event);
|
206
204
|
}
|
207
205
|
}
|
208
206
|
}, [LeftIcon(), h("div", {
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import _mergeJSXProps2 from "@vue/babel-helper-vue-jsx-merge-props";
|
2
2
|
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
3
3
|
import { deepClone } from '../utils/deep-clone';
|
4
|
-
import { createNamespace, isObject } from '../utils';
|
4
|
+
import { createNamespace, inBrowser, isObject } from '../utils';
|
5
5
|
import { range } from '../utils/format/number';
|
6
|
-
import { preventDefault } from '../utils/dom/event';
|
6
|
+
import { preventDefault, on, off } from '../utils/dom/event';
|
7
7
|
import { TouchMixin } from '../mixins/touch';
|
8
8
|
var DEFAULT_DURATION = 200; // 惯性滑动思路:
|
9
9
|
// 在手指离开屏幕时,如果和上一次 move 时的间隔小于 `MOMENTUM_LIMIT_TIME` 且 move
|
10
10
|
// 距离大于 `MOMENTUM_LIMIT_DISTANCE` 时,执行惯性滑动
|
11
11
|
|
12
|
-
var MOMENTUM_LIMIT_TIME = 300;
|
13
|
-
var MOMENTUM_LIMIT_DISTANCE = 15;
|
12
|
+
export var MOMENTUM_LIMIT_TIME = 300;
|
13
|
+
export var MOMENTUM_LIMIT_DISTANCE = 15;
|
14
14
|
|
15
15
|
var _createNamespace = createNamespace('picker-column'),
|
16
16
|
createComponent = _createNamespace[0],
|
@@ -25,8 +25,12 @@ function getElementTranslateY(element) {
|
|
25
25
|
|
26
26
|
function isOptionDisabled(option) {
|
27
27
|
return isObject(option) && option.disabled;
|
28
|
-
}
|
28
|
+
} // use standard WheelEvent:
|
29
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
30
|
+
|
29
31
|
|
32
|
+
var supportMousewheel = inBrowser && 'onwheel' in window;
|
33
|
+
var mousewheelTimer = null;
|
30
34
|
export default createComponent({
|
31
35
|
mixins: [TouchMixin],
|
32
36
|
props: {
|
@@ -62,6 +66,10 @@ export default createComponent({
|
|
62
66
|
},
|
63
67
|
mounted: function mounted() {
|
64
68
|
this.bindTouchEvent(this.$el);
|
69
|
+
|
70
|
+
if (supportMousewheel) {
|
71
|
+
on(this.$el, 'wheel', this.onMouseWheel, false);
|
72
|
+
}
|
65
73
|
},
|
66
74
|
destroyed: function destroyed() {
|
67
75
|
var children = this.$parent.children;
|
@@ -69,6 +77,10 @@ export default createComponent({
|
|
69
77
|
if (children) {
|
70
78
|
children.splice(children.indexOf(this), 1);
|
71
79
|
}
|
80
|
+
|
81
|
+
if (supportMousewheel) {
|
82
|
+
off(this.$el, 'wheel');
|
83
|
+
}
|
72
84
|
},
|
73
85
|
watch: {
|
74
86
|
initialOptions: 'setOptions',
|
@@ -156,6 +168,43 @@ export default createComponent({
|
|
156
168
|
_this.moving = false;
|
157
169
|
}, 0);
|
158
170
|
},
|
171
|
+
onMouseWheel: function onMouseWheel(event) {
|
172
|
+
var _this2 = this;
|
173
|
+
|
174
|
+
if (this.readonly) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
preventDefault(event, true); // simply combine touchstart and touchmove
|
179
|
+
|
180
|
+
var translateY = getElementTranslateY(this.$refs.wrapper);
|
181
|
+
this.startOffset = Math.min(0, translateY - this.baseOffset);
|
182
|
+
this.momentumOffset = this.startOffset;
|
183
|
+
this.transitionEndTrigger = null; // directly use deltaY, see https://caniuse.com/?search=deltaY
|
184
|
+
// use deltaY to detect direction for not special setting device
|
185
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
|
186
|
+
|
187
|
+
var deltaY = event.deltaY;
|
188
|
+
|
189
|
+
if (this.startOffset === 0 && deltaY < 0) {
|
190
|
+
return;
|
191
|
+
} // get offset
|
192
|
+
// if necessary, can adjust distance value to make scrolling smoother
|
193
|
+
|
194
|
+
|
195
|
+
var distance = -deltaY;
|
196
|
+
this.offset = range(this.startOffset + distance, -(this.count * this.itemHeight), this.itemHeight);
|
197
|
+
|
198
|
+
if (mousewheelTimer) {
|
199
|
+
clearTimeout(mousewheelTimer);
|
200
|
+
}
|
201
|
+
|
202
|
+
mousewheelTimer = setTimeout(function () {
|
203
|
+
_this2.onTouchEnd();
|
204
|
+
|
205
|
+
_this2.touchStartTime = 0;
|
206
|
+
}, MOMENTUM_LIMIT_TIME);
|
207
|
+
},
|
159
208
|
onTransitionEnd: function onTransitionEnd() {
|
160
209
|
this.stopMomentum();
|
161
210
|
},
|
@@ -187,17 +236,17 @@ export default createComponent({
|
|
187
236
|
return option;
|
188
237
|
},
|
189
238
|
setIndex: function setIndex(index, emitChange) {
|
190
|
-
var
|
239
|
+
var _this3 = this;
|
191
240
|
|
192
241
|
index = this.adjustIndex(index) || 0;
|
193
242
|
var offset = -index * this.itemHeight;
|
194
243
|
|
195
244
|
var trigger = function trigger() {
|
196
|
-
if (index !==
|
197
|
-
|
245
|
+
if (index !== _this3.currentIndex) {
|
246
|
+
_this3.currentIndex = index;
|
198
247
|
|
199
248
|
if (emitChange) {
|
200
|
-
|
249
|
+
_this3.$emit('change', index);
|
201
250
|
}
|
202
251
|
}
|
203
252
|
}; // trigger the change event after transitionend when moving
|
@@ -243,7 +292,7 @@ export default createComponent({
|
|
243
292
|
}
|
244
293
|
},
|
245
294
|
genOptions: function genOptions() {
|
246
|
-
var
|
295
|
+
var _this4 = this;
|
247
296
|
|
248
297
|
var h = this.$createElement;
|
249
298
|
var optionStyle = {
|
@@ -252,7 +301,7 @@ export default createComponent({
|
|
252
301
|
return this.options.map(function (option, index) {
|
253
302
|
var _domProps;
|
254
303
|
|
255
|
-
var text =
|
304
|
+
var text = _this4.getOptionText(option);
|
256
305
|
|
257
306
|
var disabled = isOptionDisabled(option);
|
258
307
|
var data = {
|
@@ -263,19 +312,19 @@ export default createComponent({
|
|
263
312
|
},
|
264
313
|
class: [bem('item', {
|
265
314
|
disabled: disabled,
|
266
|
-
selected: index ===
|
315
|
+
selected: index === _this4.currentIndex
|
267
316
|
})],
|
268
317
|
on: {
|
269
318
|
click: function click() {
|
270
|
-
|
319
|
+
_this4.onClickItem(index);
|
271
320
|
}
|
272
321
|
}
|
273
322
|
};
|
274
323
|
var childData = {
|
275
324
|
class: 'van-ellipsis',
|
276
|
-
domProps: (_domProps = {}, _domProps[
|
325
|
+
domProps: (_domProps = {}, _domProps[_this4.allowHtml ? 'innerHTML' : 'textContent'] = text, _domProps)
|
277
326
|
};
|
278
|
-
return h("li", _mergeJSXProps([{}, data]), [
|
327
|
+
return h("li", _mergeJSXProps([{}, data]), [_this4.slots('option', option) || h("div", _mergeJSXProps2([{}, childData]))]);
|
279
328
|
});
|
280
329
|
}
|
281
330
|
},
|
package/es/swipe/index.js
CHANGED
@@ -181,10 +181,16 @@ export default createComponent({
|
|
181
181
|
},
|
182
182
|
onTouchMove: function onTouchMove(event) {
|
183
183
|
if (!this.touchable || !this.swiping) return;
|
184
|
-
this.touchMove(event);
|
184
|
+
this.touchMove(event); // if user starting to touchmove, prevent the event bubbling to
|
185
|
+
// avoid affecting the parent components
|
185
186
|
|
186
|
-
|
187
|
+
var shouldPrevent = this.isCorrectDirection || this.offsetY > this.offsetX === this.vertical;
|
188
|
+
|
189
|
+
if (shouldPrevent) {
|
187
190
|
preventDefault(event, this.stopPropagation);
|
191
|
+
}
|
192
|
+
|
193
|
+
if (this.isCorrectDirection) {
|
188
194
|
this.move({
|
189
195
|
offset: this.delta
|
190
196
|
});
|
package/es/switch/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.van-switch{position:relative;display:inline-block;box-sizing:content-box;width:2em;height:1em;font-size:30px;background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:1em;cursor:pointer;-webkit-transition:background-color .3s;transition:background-color .3s}.van-switch__node{position:absolute;top:0;left:0;width:1em;height:1em;background-color:#fff;border-radius:100%;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);-webkit-transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05),-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;line-height:1}.van-switch--on{background-color:#1989fa}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em)}.van-switch--on .van-switch__loading{color:#1989fa}.van-switch--disabled{cursor:not-allowed;opacity:.5}.van-switch--loading{cursor:default}
|
1
|
+
.van-switch{position:relative;display:inline-block;box-sizing:content-box;width:2em;height:1em;font-size:30px;background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:1em;cursor:pointer;-webkit-transition:background-color .3s;transition:background-color .3s}.van-switch__node{position:absolute;top:0;left:0;width:1em;height:1em;font-size:inherit;background-color:#fff;border-radius:100%;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);-webkit-transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05),-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;line-height:1}.van-switch--on{background-color:#1989fa}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em)}.van-switch--on .van-switch__loading{color:#1989fa}.van-switch--disabled{cursor:not-allowed;opacity:.5}.van-switch--loading{cursor:default}
|
package/es/switch/index.less
CHANGED
package/es/tabbar/index.js
CHANGED
@@ -62,23 +62,23 @@ export default createComponent({
|
|
62
62
|
var _this = this;
|
63
63
|
|
64
64
|
this.children.forEach(function (item, index) {
|
65
|
-
item.
|
65
|
+
item.nameMatched = (item.name || index) === _this.value;
|
66
66
|
});
|
67
67
|
},
|
68
|
-
|
68
|
+
triggerChange: function triggerChange(active, afterChange) {
|
69
69
|
var _this2 = this;
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
_this2.$emit('input', active);
|
71
|
+
callInterceptor({
|
72
|
+
interceptor: this.beforeChange,
|
73
|
+
args: [active],
|
74
|
+
done: function done() {
|
75
|
+
_this2.$emit('input', active);
|
77
76
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
_this2.$emit('change', active);
|
78
|
+
|
79
|
+
afterChange();
|
80
|
+
}
|
81
|
+
});
|
82
82
|
},
|
83
83
|
genTabbar: function genTabbar() {
|
84
84
|
var _ref;
|
package/es/tabbar-item/index.js
CHANGED
@@ -25,11 +25,11 @@ export default createComponent({
|
|
25
25
|
}),
|
26
26
|
data: function data() {
|
27
27
|
return {
|
28
|
-
|
28
|
+
nameMatched: false
|
29
29
|
};
|
30
30
|
},
|
31
31
|
computed: {
|
32
|
-
|
32
|
+
routeMatched: function routeMatched() {
|
33
33
|
var to = this.to,
|
34
34
|
$route = this.$route;
|
35
35
|
|
@@ -37,22 +37,33 @@ export default createComponent({
|
|
37
37
|
var config = isObject(to) ? to : {
|
38
38
|
path: to
|
39
39
|
};
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
return !!$route.matched.find(function (r) {
|
41
|
+
var pathMatched = config.path === r.path;
|
42
|
+
var nameMatched = isDef(config.name) && config.name === r.name;
|
43
|
+
return pathMatched || nameMatched;
|
44
|
+
});
|
43
45
|
}
|
46
|
+
},
|
47
|
+
active: function active() {
|
48
|
+
return this.parent.route ? this.routeMatched : this.nameMatched;
|
44
49
|
}
|
45
50
|
},
|
46
51
|
methods: {
|
47
52
|
onClick: function onClick(event) {
|
48
|
-
|
53
|
+
var _this = this;
|
54
|
+
|
55
|
+
if (!this.active) {
|
56
|
+
this.parent.triggerChange(this.name || this.index, function () {
|
57
|
+
route(_this.$router, _this);
|
58
|
+
});
|
59
|
+
}
|
60
|
+
|
49
61
|
this.$emit('click', event);
|
50
|
-
route(this.$router, this);
|
51
62
|
},
|
52
|
-
genIcon: function genIcon(
|
63
|
+
genIcon: function genIcon() {
|
53
64
|
var h = this.$createElement;
|
54
65
|
var slot = this.slots('icon', {
|
55
|
-
active: active
|
66
|
+
active: this.active
|
56
67
|
});
|
57
68
|
|
58
69
|
if (slot) {
|
@@ -73,7 +84,7 @@ export default createComponent({
|
|
73
84
|
var _this$badge;
|
74
85
|
|
75
86
|
var h = arguments[0];
|
76
|
-
var active = this.
|
87
|
+
var active = this.active;
|
77
88
|
var color = this.parent[active ? 'activeColor' : 'inactiveColor'];
|
78
89
|
|
79
90
|
if (process.env.NODE_ENV === 'development' && this.info) {
|
@@ -92,7 +103,7 @@ export default createComponent({
|
|
92
103
|
}
|
93
104
|
}, [h("div", {
|
94
105
|
"class": bem('icon')
|
95
|
-
}, [this.genIcon(
|
106
|
+
}, [this.genIcon(), h(Info, {
|
96
107
|
"attrs": {
|
97
108
|
"dot": this.dot,
|
98
109
|
"info": (_this$badge = this.badge) != null ? _this$badge : this.info
|
@@ -125,6 +125,9 @@ var _default = createComponent({
|
|
125
125
|
this.updateInnerValue();
|
126
126
|
this.$nextTick(function () {
|
127
127
|
_this2.$nextTick(function () {
|
128
|
+
// https://github.com/youzan/vant/issues/9775
|
129
|
+
_this2.updateInnerValue();
|
130
|
+
|
128
131
|
_this2.$emit('change', picker);
|
129
132
|
});
|
130
133
|
});
|
package/lib/field/index.js
CHANGED
@@ -354,13 +354,15 @@ var _default = createComponent({
|
|
354
354
|
|
355
355
|
/* istanbul ignore if */
|
356
356
|
|
357
|
-
|
358
|
-
|
359
|
-
if (readonly) {
|
357
|
+
if (this.getProp('readonly')) {
|
360
358
|
this.blur();
|
361
359
|
}
|
362
360
|
},
|
363
361
|
onBlur: function onBlur(event) {
|
362
|
+
if (this.getProp('readonly')) {
|
363
|
+
return;
|
364
|
+
}
|
365
|
+
|
364
366
|
this.focused = false;
|
365
367
|
this.updateValue(this.value, 'onBlur');
|
366
368
|
this.$emit('blur', event);
|