vant 2.12.29 → 2.12.31

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 CHANGED
@@ -29,16 +29,17 @@
29
29
 
30
30
  ## Features
31
31
 
32
- - 65+ Reusable components
33
- - 1kb Component average size (min+gzip)
34
- - 90%+ Unit test coverage
35
- - Extensive documentation and demos
36
- - Support Vue 2 & Vue 3
37
- - Support Tree Shaking
38
- - Support Custom Theme
39
- - Support i18n
40
- - Support TS
41
- - Support SSR
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
 
package/README.zh-CN.md CHANGED
@@ -32,16 +32,17 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源
32
32
 
33
33
  ## 特性
34
34
 
35
- - 提供 60 多个高质量组件,覆盖移动端各类场景
36
- - 性能极佳,组件平均体积不到 1kb(min+gzip)
37
- - 单元测试覆盖率 90%+,提供稳定性保障
38
- - 完善的中英文文档和示例
39
- - 支持 Vue 2 & Vue 3
40
- - 支持按需引入
41
- - 支持主题定制
42
- - 支持国际化
43
- - 支持 TypeScript
44
- - 支持 SSR
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
 
package/es/field/index.js CHANGED
@@ -333,7 +333,9 @@ export default createComponent({
333
333
  },
334
334
  onFocus: function onFocus(event) {
335
335
  this.focused = true;
336
- this.$emit('focus', event); // readonly not work in legacy mobile safari
336
+ this.$emit('focus', event); // https://github.com/youzan/vant/issues/9715
337
+
338
+ this.$nextTick(this.adjustSize); // readonly not work in legacy mobile safari
337
339
 
338
340
  /* istanbul ignore if */
339
341
 
@@ -348,6 +350,7 @@ export default createComponent({
348
350
  this.updateValue(this.value, 'onBlur');
349
351
  this.$emit('blur', event);
350
352
  this.validateWithTrigger('onBlur');
353
+ this.$nextTick(this.adjustSize);
351
354
  resetScroll();
352
355
  },
353
356
  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.29';
90
+ var version = '2.12.31';
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];
@@ -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,
@@ -126,6 +126,16 @@ export default createComponent({
126
126
  return value;
127
127
  };
128
128
  },
129
+ getExtraDesc: function getExtraDesc(message) {
130
+ var h = this.$createElement;
131
+ var extraDesc = message.extraDesc;
132
+
133
+ if (extraDesc) {
134
+ return h("div", {
135
+ "class": bem('extra-message')
136
+ }, [extraDesc]);
137
+ }
138
+ },
129
139
  genMessage: function genMessage(message, index) {
130
140
  var _this2 = this;
131
141
 
@@ -178,7 +188,9 @@ export default createComponent({
178
188
  });
179
189
  }
180
190
 
181
- return h(Field, {
191
+ return h("div", {
192
+ "class": bem('cell-block')
193
+ }, [h(Field, {
182
194
  "attrs": {
183
195
  "maxlength": "200",
184
196
  "center": !message.multiple,
@@ -186,7 +198,8 @@ export default createComponent({
186
198
  "required": String(message.required) === '1',
187
199
  "placeholder": this.getPlaceholder(message),
188
200
  "type": this.getType(message),
189
- "formatter": this.getFormatter(message)
201
+ "formatter": this.getFormatter(message),
202
+ "border": false
190
203
  },
191
204
  "key": this.goodsId + "-" + index,
192
205
  "model": {
@@ -195,7 +208,7 @@ export default createComponent({
195
208
  _this2.$set(_this2.messageValues[index], "value", $$v);
196
209
  }
197
210
  }
198
- });
211
+ }), this.getExtraDesc(message)]);
199
212
  }
200
213
  },
201
214
  render: function render() {
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-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
@@ -1,5 +1,6 @@
1
1
  @import '../style/var';
2
2
  @import '../style/mixins/clearfix';
3
+ @import '../style/mixins/hairline';
3
4
 
4
5
  .van-sku {
5
6
  &-container {
@@ -342,6 +343,26 @@
342
343
  line-height: @cell-label-line-height;
343
344
  }
344
345
  }
346
+
347
+ &__cell-block {
348
+ position: relative;
349
+
350
+ &::after {
351
+ .hairline-bottom(@cell-border-color, @padding-md, @padding-md);
352
+ }
353
+
354
+ &:last-child::after {
355
+ display: none;
356
+ }
357
+ }
358
+
359
+ &__extra-message {
360
+ margin-top: -2px;
361
+ padding: 0 16px 12px;
362
+ color: @cell-label-color;
363
+ font-size: @cell-label-font-size;
364
+ line-height: @cell-label-line-height;
365
+ }
345
366
  }
346
367
 
347
368
  &-actions {
@@ -348,7 +348,9 @@ var _default = createComponent({
348
348
  },
349
349
  onFocus: function onFocus(event) {
350
350
  this.focused = true;
351
- this.$emit('focus', event); // readonly not work in legacy mobile safari
351
+ this.$emit('focus', event); // https://github.com/youzan/vant/issues/9715
352
+
353
+ this.$nextTick(this.adjustSize); // readonly not work in legacy mobile safari
352
354
 
353
355
  /* istanbul ignore if */
354
356
 
@@ -363,6 +365,7 @@ var _default = createComponent({
363
365
  this.updateValue(this.value, 'onBlur');
364
366
  this.$emit('blur', event);
365
367
  this.validateWithTrigger('onBlur');
368
+ this.$nextTick(this.adjustSize);
366
369
  (0, _resetScroll.resetScroll)();
367
370
  },
368
371
  onClick: function onClick(event) {