vant 2.12.30-beta.0 → 2.12.32
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 +14 -12
- package/README.zh-CN.md +13 -11
- package/es/field/index.js +9 -4
- package/es/index.js +1 -1
- package/es/notice-bar/index.js +28 -30
- package/es/picker/PickerColumn.js +63 -14
- package/es/progress/index.js +5 -0
- package/es/sku/index.css +1 -1
- package/es/sku/index.less +4 -0
- 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 +17 -8
- package/lib/field/index.js +9 -4
- 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/progress/index.js +6 -0
- package/lib/sku/index.css +1 -1
- package/lib/sku/index.less +4 -0
- 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 +17 -8
- package/lib/vant.js +136 -70
- package/lib/vant.min.js +1 -1
- package/package.json +1 -1
- package/vetur/attributes.json +187 -187
- package/vetur/tags.json +68 -68
- package/vetur/web-types.json +613 -613
- package/changelog.generated.md +0 -16
package/README.md
CHANGED
@@ -29,16 +29,17 @@
|
|
29
29
|
|
30
30
|
## Features
|
31
31
|
|
32
|
-
-
|
33
|
-
-
|
34
|
-
- 90%+ Unit test coverage
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
- Support
|
39
|
-
- Support
|
40
|
-
- Support
|
41
|
-
- Support
|
32
|
+
- 🚀 1KB Component average size (min+gzip)
|
33
|
+
- 🚀 65+ High quality components
|
34
|
+
- 💪 90%+ Unit test coverage
|
35
|
+
- 💪 Written in TypeScript
|
36
|
+
- 📖 Extensive documentation and demos
|
37
|
+
- 📖 Provide Sketch and Axure design resources
|
38
|
+
- 🍭 Support Vue 2 & Vue 3
|
39
|
+
- 🍭 Support Tree Shaking
|
40
|
+
- 🍭 Support Custom Theme
|
41
|
+
- 🍭 Support i18n
|
42
|
+
- 🌍 Support SSR
|
42
43
|
|
43
44
|
## Install
|
44
45
|
|
@@ -86,11 +87,12 @@ Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3).
|
|
86
87
|
|
87
88
|
| Project | Description |
|
88
89
|
| --- | --- |
|
89
|
-
| [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 |
|
90
91
|
| [mxdi9i7/vant-react](https://github.com/mxdi9i7/vant-react) | Mobile UI Components built on React and TS, inspired by Vant |
|
91
92
|
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
|
92
93
|
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
|
93
|
-
| [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 |
|
94
96
|
|
95
97
|
## Links
|
96
98
|
|
package/README.zh-CN.md
CHANGED
@@ -32,16 +32,17 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源
|
|
32
32
|
|
33
33
|
## 特性
|
34
34
|
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
35
|
+
- 🚀 性能极佳,组件平均体积小于 1KB(min+gzip)
|
36
|
+
- 🚀 65+ 个高质量组件,覆盖移动端主流场景
|
37
|
+
- 💪 使用 TypeScript 编写,提供完整的类型定义
|
38
|
+
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
|
39
|
+
- 📖 提供完善的中英文文档和组件示例
|
40
|
+
- 📖 提供 Sketch 和 Axure 设计资源
|
41
|
+
- 🍭 支持 Vue 2、Vue 3 和微信小程序
|
42
|
+
- 🍭 支持主题定制,内置 700+ 个主题变量
|
43
|
+
- 🍭 支持按需引入和 Tree Shaking
|
44
|
+
- 🍭 支持服务器端渲染
|
45
|
+
- 🌍 支持国际化和语言包定制
|
45
46
|
|
46
47
|
## 安装
|
47
48
|
|
@@ -95,11 +96,12 @@ Vant 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致
|
|
95
96
|
|
96
97
|
| 项目 | 描述 |
|
97
98
|
| --- | --- |
|
98
|
-
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React
|
99
|
+
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 移动端组件库 |
|
99
100
|
| [mxdi9i7/vant-react](https://github.com/mxdi9i7/vant-react) | 基于 React 和 TS 构建的移动端组件库 |
|
100
101
|
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 |
|
101
102
|
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 |
|
102
103
|
| [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 |
|
104
|
+
| [@antmjs/vantui](https://github.com/antmjs/vantui) | 基于 Vant Weapp 开发的多端组件库,同时支持 Taro 和 React |
|
103
105
|
|
104
106
|
## 链接
|
105
107
|
|
package/es/field/index.js
CHANGED
@@ -333,21 +333,26 @@ export default createComponent({
|
|
333
333
|
},
|
334
334
|
onFocus: function onFocus(event) {
|
335
335
|
this.focused = true;
|
336
|
-
this.$emit('focus', event); //
|
336
|
+
this.$emit('focus', event); // https://github.com/youzan/vant/issues/9715
|
337
337
|
|
338
|
-
|
338
|
+
this.$nextTick(this.adjustSize); // readonly not work in legacy mobile safari
|
339
339
|
|
340
|
-
|
340
|
+
/* istanbul ignore if */
|
341
341
|
|
342
|
-
if (readonly) {
|
342
|
+
if (this.getProp('readonly')) {
|
343
343
|
this.blur();
|
344
344
|
}
|
345
345
|
},
|
346
346
|
onBlur: function onBlur(event) {
|
347
|
+
if (this.getProp('readonly')) {
|
348
|
+
return;
|
349
|
+
}
|
350
|
+
|
347
351
|
this.focused = false;
|
348
352
|
this.updateValue(this.value, 'onBlur');
|
349
353
|
this.$emit('blur', event);
|
350
354
|
this.validateWithTrigger('onBlur');
|
355
|
+
this.$nextTick(this.adjustSize);
|
351
356
|
resetScroll();
|
352
357
|
},
|
353
358
|
onClick: function onClick(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.32';
|
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", {
|
@@ -3,14 +3,14 @@ import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
|
3
3
|
import { deepClone } from '../utils/deep-clone';
|
4
4
|
import { createNamespace, 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 = ('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/progress/index.js
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
import { createNamespace, addUnit } from '../utils';
|
2
|
+
import { BindEventMixin } from '../mixins/bind-event';
|
2
3
|
|
3
4
|
var _createNamespace = createNamespace('progress'),
|
4
5
|
createComponent = _createNamespace[0],
|
5
6
|
bem = _createNamespace[1];
|
6
7
|
|
7
8
|
export default createComponent({
|
9
|
+
mixins: [BindEventMixin(function (bind) {
|
10
|
+
bind(window, 'resize', this.resize, true);
|
11
|
+
bind(window, 'orientationchange', this.resize, true);
|
12
|
+
})],
|
8
13
|
props: {
|
9
14
|
color: String,
|
10
15
|
inactive: Boolean,
|
package/es/sku/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.van-sku-container{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;min-height:50%;max-height:80%;overflow-y:visible;font-size:14px;background:#fff}.van-sku-body{-webkit-box-flex:1;-webkit-flex:1 1 auto;flex:1 1 auto;min-height:44px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.van-sku-body::-webkit-scrollbar{display:none}.van-sku-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;margin:0 16px}.van-sku-header__img-wrap{-webkit-flex-shrink:0;flex-shrink:0;width:96px;height:96px;margin:12px 12px 12px 0;overflow:hidden;border-radius:4px}.van-sku-header__goods-info{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;padding:12px 20px 12px 0}.van-sku-header-item{margin-top:8px;color:#969799;font-size:12px;line-height:16px}.van-sku__price-symbol{font-size:16px;vertical-align:bottom}.van-sku__price-num{font-weight:500;font-size:22px;vertical-align:bottom;word-wrap:break-word}.van-sku__goods-price{margin-left:-2px;color:#ee0a24}.van-sku__price-tag{position:relative;display:inline-block;margin-left:8px;padding:0 5px;overflow:hidden;color:#ee0a24;font-size:12px;line-height:16px;border-radius:8px}.van-sku__price-tag::before{position:absolute;top:0;left:0;width:100%;height:100%;background:currentColor;opacity:.1;content:''}.van-sku-group-container{padding-top:12px}.van-sku-group-container--hide-soldout .van-sku-row__item--disabled{display:none}.van-sku-row{margin:0 16px 12px}.van-sku-row:last-child{margin-bottom:0}.van-sku-row__image-item,.van-sku-row__item{position:relative;overflow:hidden;color:#323233;border-radius:4px;cursor:pointer}.van-sku-row__image-item::before,.van-sku-row__item::before{position:absolute;top:0;left:0;width:100%;height:100%;background:#f7f8fa;content:''}.van-sku-row__image-item--active,.van-sku-row__item--active{color:#ee0a24}.van-sku-row__image-item--active::before,.van-sku-row__item--active::before{background:currentColor;opacity:.1}.van-sku-row__item{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-width:40px;margin:0 12px 12px 0;font-size:13px;line-height:16px;vertical-align:middle}.van-sku-row__item-img{z-index:1;width:24px;height:24px;margin:4px 0 4px 4px;object-fit:cover;border-radius:2px}.van-sku-row__item-name{z-index:1;padding:8px}.van-sku-row__item--disabled{color:#c8c9cc;background:#f2f3f5;cursor:not-allowed}.van-sku-row__item--disabled .van-sku-row__item-img{opacity:.3}.van-sku-row__image{margin-right:0}.van-sku-row__image-item{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;width:110px;margin:0 4px 4px 0;border:1px solid transparent}.van-sku-row__image-item:last-child{margin-right:0}.van-sku-row__image-item-img{width:100%;height:110px}.van-sku-row__image-item-img-icon{position:absolute;top:0;right:0;z-index:3;width:18px;height:18px;color:#fff;line-height:18px;text-align:center;background-color:rgba(0,0,0,.4);border-bottom-left-radius:4px}.van-sku-row__image-item-name{position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;height:40px;padding:4px;font-size:12px;line-height:16px}.van-sku-row__image-item-name span{word-wrap:break-word}.van-sku-row__image-item--active{border-color:currentColor}.van-sku-row__image-item--disabled{color:#c8c9cc;cursor:not-allowed}.van-sku-row__image-item--disabled::before{z-index:2;background:#f2f3f5;opacity:.4}.van-sku-row__title{padding-bottom:12px}.van-sku-row__title-multiple{color:#969799}.van-sku-row__scroller{margin:0 -16px;overflow-x:scroll;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-sku-row__scroller::-webkit-scrollbar{display:none}.van-sku-row__row{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;margin-bottom:4px;padding:0 16px}.van-sku-row__indicator{width:40px;height:4px;background:#ebedf0;border-radius:2px}.van-sku-row__indicator-wrapper{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;padding-bottom:16px}.van-sku-row__indicator-slider{width:50%;height:100%;background-color:#ee0a24;border-radius:2px}.van-sku-stepper-stock{padding:12px 16px;overflow:hidden;line-height:30px}.van-sku__stepper{float:right;padding-left:4px}.van-sku__stepper-title{float:left}.van-sku__stepper-quota{float:right;color:#ee0a24;font-size:12px}.van-sku__stock{display:inline-block;margin-right:8px;color:#969799;font-size:12px}.van-sku__stock-num--highlight{color:#ee0a24}.van-sku-messages{padding-bottom:32px}.van-sku-messages__image-cell .van-cell__title{max-width:6.2em;margin-right:12px;color:#646566;text-align:left;word-wrap:break-word}.van-sku-messages__image-cell .van-cell__value{overflow:visible;text-align:left}.van-sku-messages__image-cell-label{color:#969799;font-size:12px;line-height:18px}.van-sku-messages__cell-block{position:relative}.van-sku-messages__cell-block::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-sku-messages__extra-message{margin-top:-2px;padding:0 16px 12px;color:#969799;font-size:12px;line-height:18px}.van-sku-actions{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;padding:8px 16px}.van-sku-actions .van-button{height:40px;font-weight:500;font-size:14px;border:none;border-radius:0}.van-sku-actions .van-button:first-of-type{border-top-left-radius:20px;border-bottom-left-radius:20px}.van-sku-actions .van-button:last-of-type{border-top-right-radius:20px;border-bottom-right-radius:20px}.van-sku-actions .van-button--warning{background:-webkit-linear-gradient(left,#ffd01e,#ff8917);background:linear-gradient(to right,#ffd01e,#ff8917)}.van-sku-actions .van-button--danger{background:-webkit-linear-gradient(left,#ff6034,#ee0a24);background:linear-gradient(to right,#ff6034,#ee0a24)}
|
1
|
+
.van-sku-container{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;min-height:50%;max-height:80%;overflow-y:visible;font-size:14px;background:#fff}.van-sku-body{-webkit-box-flex:1;-webkit-flex:1 1 auto;flex:1 1 auto;min-height:44px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.van-sku-body::-webkit-scrollbar{display:none}.van-sku-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;margin:0 16px}.van-sku-header__img-wrap{-webkit-flex-shrink:0;flex-shrink:0;width:96px;height:96px;margin:12px 12px 12px 0;overflow:hidden;border-radius:4px}.van-sku-header__goods-info{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;padding:12px 20px 12px 0}.van-sku-header-item{margin-top:8px;color:#969799;font-size:12px;line-height:16px}.van-sku__price-symbol{font-size:16px;vertical-align:bottom}.van-sku__price-num{font-weight:500;font-size:22px;vertical-align:bottom;word-wrap:break-word}.van-sku__goods-price{margin-left:-2px;color:#ee0a24}.van-sku__price-tag{position:relative;display:inline-block;margin-left:8px;padding:0 5px;overflow:hidden;color:#ee0a24;font-size:12px;line-height:16px;border-radius:8px}.van-sku__price-tag::before{position:absolute;top:0;left:0;width:100%;height:100%;background:currentColor;opacity:.1;content:''}.van-sku-group-container{padding-top:12px}.van-sku-group-container--hide-soldout .van-sku-row__item--disabled{display:none}.van-sku-row{margin:0 16px 12px}.van-sku-row:last-child{margin-bottom:0}.van-sku-row__image-item,.van-sku-row__item{position:relative;overflow:hidden;color:#323233;border-radius:4px;cursor:pointer}.van-sku-row__image-item::before,.van-sku-row__item::before{position:absolute;top:0;left:0;width:100%;height:100%;background:#f7f8fa;content:''}.van-sku-row__image-item--active,.van-sku-row__item--active{color:#ee0a24}.van-sku-row__image-item--active::before,.van-sku-row__item--active::before{background:currentColor;opacity:.1}.van-sku-row__item{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-width:40px;margin:0 12px 12px 0;font-size:13px;line-height:16px;vertical-align:middle}.van-sku-row__item-img{z-index:1;width:24px;height:24px;margin:4px 0 4px 4px;object-fit:cover;border-radius:2px}.van-sku-row__item-name{z-index:1;padding:8px}.van-sku-row__item--disabled{color:#c8c9cc;background:#f2f3f5;cursor:not-allowed}.van-sku-row__item--disabled .van-sku-row__item-img{opacity:.3}.van-sku-row__image{margin-right:0}.van-sku-row__image-item{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;width:110px;margin:0 4px 4px 0;border:1px solid transparent}.van-sku-row__image-item:last-child{margin-right:0}.van-sku-row__image-item-img{width:100%;height:110px}.van-sku-row__image-item-img-icon{position:absolute;top:0;right:0;z-index:3;width:18px;height:18px;color:#fff;line-height:18px;text-align:center;background-color:rgba(0,0,0,.4);border-bottom-left-radius:4px}.van-sku-row__image-item-name{position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;height:40px;padding:4px;font-size:12px;line-height:16px}.van-sku-row__image-item-name span{word-wrap:break-word}.van-sku-row__image-item--active{border-color:currentColor}.van-sku-row__image-item--disabled{color:#c8c9cc;cursor:not-allowed}.van-sku-row__image-item--disabled::before{z-index:2;background:#f2f3f5;opacity:.4}.van-sku-row__title{padding-bottom:12px}.van-sku-row__title-multiple{color:#969799}.van-sku-row__scroller{margin:0 -16px;overflow-x:scroll;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-sku-row__scroller::-webkit-scrollbar{display:none}.van-sku-row__row{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;margin-bottom:4px;padding:0 16px}.van-sku-row__indicator{width:40px;height:4px;background:#ebedf0;border-radius:2px}.van-sku-row__indicator-wrapper{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;padding-bottom:16px}.van-sku-row__indicator-slider{width:50%;height:100%;background-color:#ee0a24;border-radius:2px}.van-sku-stepper-stock{padding:12px 16px;overflow:hidden;line-height:30px}.van-sku__stepper{float:right;padding-left:4px}.van-sku__stepper-title{float:left}.van-sku__stepper-quota{float:right;color:#ee0a24;font-size:12px}.van-sku__stock{display:inline-block;margin-right:8px;color:#969799;font-size:12px}.van-sku__stock-num--highlight{color:#ee0a24}.van-sku-messages{padding-bottom:32px}.van-sku-messages__image-cell .van-cell__title{max-width:6.2em;margin-right:12px;color:#646566;text-align:left;word-wrap:break-word}.van-sku-messages__image-cell .van-cell__value{overflow:visible;text-align:left}.van-sku-messages__image-cell-label{color:#969799;font-size:12px;line-height:18px}.van-sku-messages__cell-block{position:relative}.van-sku-messages__cell-block::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-sku-messages__cell-block:last-child::after{display:none}.van-sku-messages__extra-message{margin-top:-2px;padding:0 16px 12px;color:#969799;font-size:12px;line-height:18px}.van-sku-actions{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;padding:8px 16px}.van-sku-actions .van-button{height:40px;font-weight:500;font-size:14px;border:none;border-radius:0}.van-sku-actions .van-button:first-of-type{border-top-left-radius:20px;border-bottom-left-radius:20px}.van-sku-actions .van-button:last-of-type{border-top-right-radius:20px;border-bottom-right-radius:20px}.van-sku-actions .van-button--warning{background:-webkit-linear-gradient(left,#ffd01e,#ff8917);background:linear-gradient(to right,#ffd01e,#ff8917)}.van-sku-actions .van-button--danger{background:-webkit-linear-gradient(left,#ff6034,#ee0a24);background:linear-gradient(to right,#ff6034,#ee0a24)}
|
package/es/sku/index.less
CHANGED
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
|
|
@@ -41,18 +41,27 @@ export default createComponent({
|
|
41
41
|
var nameMatched = isDef(config.name) && config.name === $route.name;
|
42
42
|
return pathMatched || nameMatched;
|
43
43
|
}
|
44
|
+
},
|
45
|
+
active: function active() {
|
46
|
+
return this.parent.route ? this.routeMatched : this.nameMatched;
|
44
47
|
}
|
45
48
|
},
|
46
49
|
methods: {
|
47
50
|
onClick: function onClick(event) {
|
48
|
-
|
51
|
+
var _this = this;
|
52
|
+
|
53
|
+
if (!this.active) {
|
54
|
+
this.parent.triggerChange(this.name || this.index, function () {
|
55
|
+
route(_this.$router, _this);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
49
59
|
this.$emit('click', event);
|
50
|
-
route(this.$router, this);
|
51
60
|
},
|
52
|
-
genIcon: function genIcon(
|
61
|
+
genIcon: function genIcon() {
|
53
62
|
var h = this.$createElement;
|
54
63
|
var slot = this.slots('icon', {
|
55
|
-
active: active
|
64
|
+
active: this.active
|
56
65
|
});
|
57
66
|
|
58
67
|
if (slot) {
|
@@ -73,7 +82,7 @@ export default createComponent({
|
|
73
82
|
var _this$badge;
|
74
83
|
|
75
84
|
var h = arguments[0];
|
76
|
-
var active = this.
|
85
|
+
var active = this.active;
|
77
86
|
var color = this.parent[active ? 'activeColor' : 'inactiveColor'];
|
78
87
|
|
79
88
|
if (process.env.NODE_ENV === 'development' && this.info) {
|
@@ -92,7 +101,7 @@ export default createComponent({
|
|
92
101
|
}
|
93
102
|
}, [h("div", {
|
94
103
|
"class": bem('icon')
|
95
|
-
}, [this.genIcon(
|
104
|
+
}, [this.genIcon(), h(Info, {
|
96
105
|
"attrs": {
|
97
106
|
"dot": this.dot,
|
98
107
|
"info": (_this$badge = this.badge) != null ? _this$badge : this.info
|
package/lib/field/index.js
CHANGED
@@ -348,21 +348,26 @@ var _default = createComponent({
|
|
348
348
|
},
|
349
349
|
onFocus: function onFocus(event) {
|
350
350
|
this.focused = true;
|
351
|
-
this.$emit('focus', event); //
|
351
|
+
this.$emit('focus', event); // https://github.com/youzan/vant/issues/9715
|
352
352
|
|
353
|
-
|
353
|
+
this.$nextTick(this.adjustSize); // readonly not work in legacy mobile safari
|
354
354
|
|
355
|
-
|
355
|
+
/* istanbul ignore if */
|
356
356
|
|
357
|
-
if (readonly) {
|
357
|
+
if (this.getProp('readonly')) {
|
358
358
|
this.blur();
|
359
359
|
}
|
360
360
|
},
|
361
361
|
onBlur: function onBlur(event) {
|
362
|
+
if (this.getProp('readonly')) {
|
363
|
+
return;
|
364
|
+
}
|
365
|
+
|
362
366
|
this.focused = false;
|
363
367
|
this.updateValue(this.value, 'onBlur');
|
364
368
|
this.$emit('blur', event);
|
365
369
|
this.validateWithTrigger('onBlur');
|
370
|
+
this.$nextTick(this.adjustSize);
|
366
371
|
(0, _resetScroll.resetScroll)();
|
367
372
|
},
|
368
373
|
onClick: function onClick(event) {
|