From d4e321ed334f7cd60d592710363fdaa46042a5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 9 Feb 2018 10:41:38 +0800 Subject: [PATCH 01/41] [Doc] fix router redirect error --- docs/src/examples.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/src/examples.js b/docs/src/examples.js index f3b3d17eb..7251e6cf4 100644 --- a/docs/src/examples.js +++ b/docs/src/examples.js @@ -28,7 +28,9 @@ router.afterEach(() => { if (router.currentRoute.name) { window.scrollTo(0, 0); } - Vue.nextTick(() => window.syncPath()); + if (!router.currentRoute.redirectedFrom) { + Vue.nextTick(() => window.syncPath()); + } }); window.vueRouter = router; From be60e268dfb57a466449344f63eb8db9342852fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 9 Feb 2018 11:10:07 +0800 Subject: [PATCH 02/41] [changelog] 0.12.9 --- docs/markdown/en-US/changelog.md | 15 ++++++++++++++ docs/markdown/zh-CN/changelog-generated.md | 23 ++++++++++++++++++++++ docs/markdown/zh-CN/changelog.md | 16 +++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/docs/markdown/en-US/changelog.md b/docs/markdown/en-US/changelog.md index 2fc3b2c55..272b66e4b 100644 --- a/docs/markdown/en-US/changelog.md +++ b/docs/markdown/en-US/changelog.md @@ -1,5 +1,20 @@ ## Changelog +### [0.12.9](https://github.com/youzan/vant/tree/v0.12.9) +`2018-02-08` + +**Improvements** + +* PullRefresh: add refersh event [\#625](https://github.com/youzan/vant/pull/625) [@chenjiahan](https://github.com/chenjiahan) +* Circle: optimzie linecap [\#624](https://github.com/youzan/vant/pull/624) [@chenjiahan](https://github.com/chenjiahan) +* Picker: add loading prop [\#619](https://github.com/youzan/vant/pull/619) [@chenjiahan](https://github.com/chenjiahan) +* Loading: add size prop [\#620](https://github.com/youzan/vant/pull/620) [@chenjiahan](https://github.com/chenjiahan) +* Loading: add circular type [\#618](https://github.com/youzan/vant/pull/618) [@chenjiahan](https://github.com/chenjiahan) +* Loading: change default type to circular [\#623](https://github.com/youzan/vant/pull/623) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** +* fix Sku message observation [\#627](https://github.com/youzan/vant/pull/627) [@w91](https://github.com/w91) + ### [0.12.8](https://github.com/youzan/vant/tree/v0.12.8) `2018-02-07` diff --git a/docs/markdown/zh-CN/changelog-generated.md b/docs/markdown/zh-CN/changelog-generated.md index 7ad378093..9b400d805 100644 --- a/docs/markdown/zh-CN/changelog-generated.md +++ b/docs/markdown/zh-CN/changelog-generated.md @@ -1,5 +1,28 @@ ## 更新日志 +## [v0.12.9](https://github.com/youzan/vant/tree/v0.12.9) (2018-02-08) +[Full Changelog](https://github.com/youzan/vant/compare/v0.12.8...v0.12.9) + +**Breaking changes** + +- 能否增加一个进度环组件Circle [\#599](https://github.com/youzan/vant/issues/599) + +**Issue** + +- PullRefresh 下拉刷新?没有下拉加载。。。社区怎么没人啊? [\#614](https://github.com/youzan/vant/issues/614) +- tabs 的title能否加个slot? [\#574](https://github.com/youzan/vant/issues/574) + +**Improvements** + +- \[bugfix\] 修复sku数据改变后skuMessages没有更新的bug [\#627](https://github.com/youzan/vant/pull/627) ([w91](https://github.com/w91)) +- \[Doc\] optimzie demo display [\#626](https://github.com/youzan/vant/pull/626) ([chenjiahan](https://github.com/chenjiahan)) +- \[Improvement\] PullRefresh: add refersh event [\#625](https://github.com/youzan/vant/pull/625) ([chenjiahan](https://github.com/chenjiahan)) +- \[Improvement\] Circle: optimzie linecap [\#624](https://github.com/youzan/vant/pull/624) ([chenjiahan](https://github.com/chenjiahan)) +- \[Improvement\] Loading: change default type to circular [\#623](https://github.com/youzan/vant/pull/623) ([chenjiahan](https://github.com/chenjiahan)) +- \[Improvement\] Loading: add size prop [\#620](https://github.com/youzan/vant/pull/620) ([chenjiahan](https://github.com/chenjiahan)) +- \[new feature\] Picker: add loading prop [\#619](https://github.com/youzan/vant/pull/619) ([chenjiahan](https://github.com/chenjiahan)) +- \[new feature\] Loading: add circular type [\#618](https://github.com/youzan/vant/pull/618) ([chenjiahan](https://github.com/chenjiahan)) + ## [v0.12.8](https://github.com/youzan/vant/tree/v0.12.8) (2018-02-07) [Full Changelog](https://github.com/youzan/vant/compare/v0.12.7...v0.12.8) diff --git a/docs/markdown/zh-CN/changelog.md b/docs/markdown/zh-CN/changelog.md index 1f6684ca8..74b7acbd1 100644 --- a/docs/markdown/zh-CN/changelog.md +++ b/docs/markdown/zh-CN/changelog.md @@ -1,5 +1,21 @@ ## 更新日志 +### [0.12.9](https://github.com/youzan/vant/tree/v0.12.9) +`2018-02-08` + +**Improvements** + +* PullRefresh: 新增 refersh 事件 [\#625](https://github.com/youzan/vant/pull/625) [@chenjiahan](https://github.com/chenjiahan) +* Circle: 优化线条圆角 [\#624](https://github.com/youzan/vant/pull/624) [@chenjiahan](https://github.com/chenjiahan) +* Picker: 新增 loading 属性 [\#619](https://github.com/youzan/vant/pull/619) [@chenjiahan](https://github.com/chenjiahan) +* Loading: 新增 size 属性 [\#620](https://github.com/youzan/vant/pull/620) [@chenjiahan](https://github.com/chenjiahan) +* Loading: 新增 circular 类型 [\#618](https://github.com/youzan/vant/pull/618) [@chenjiahan](https://github.com/chenjiahan) +* Loading: 默认类型调整为 circular [\#623](https://github.com/youzan/vant/pull/623) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** +* 修复 Sku message 更新时未重新渲染的问题 [\#627](https://github.com/youzan/vant/pull/627) [@w91](https://github.com/w91) + + ### [0.12.8](https://github.com/youzan/vant/tree/v0.12.8) `2018-02-07` From bdd68060b458b6834da591e379dc7e35a37f6659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 9 Feb 2018 11:11:35 +0800 Subject: [PATCH 03/41] [Doc] fix language switch --- docs/src/utils/iframe-router.js | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/utils/iframe-router.js b/docs/src/utils/iframe-router.js index 5d45298a6..c705bdc2b 100644 --- a/docs/src/utils/iframe-router.js +++ b/docs/src/utils/iframe-router.js @@ -23,6 +23,7 @@ window.syncPath = function(dir) { iframe.contentWindow.changePath(lang, currentDir); }); } + setLang(lang); } else if (isInIframe) { window.top.changePath(lang, currentDir); } From 6ac8a8d2c0309e3e0a09295498cb8e890b59dbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 9 Feb 2018 11:21:18 +0800 Subject: [PATCH 04/41] [Doc] fix manually import --- README.md | 2 +- README.zh-CN.md | 2 +- docs/markdown/en-US/quickstart.md | 2 +- docs/markdown/zh-CN/quickstart.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9ea8ae4b4..1422e6426 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ import { Button } from 'vant'; #### 2. Manually import ```js -import { Button } from 'vant/lib/button'; +import Button from 'vant/lib/button'; import 'vant/lib/vant-css/base.css'; import 'vant/lib/vant-css/button.css'; ``` diff --git a/README.zh-CN.md b/README.zh-CN.md index 90ab78423..76c8c13fa 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -59,7 +59,7 @@ import { Button } from 'vant'; #### 方式二. 按需引入组件 ```js -import { Button } from 'vant/lib/button'; +import Button from 'vant/lib/button'; import 'vant/lib/vant-css/base.css'; import 'vant/lib/vant-css/button.css'; ``` diff --git a/docs/markdown/en-US/quickstart.md b/docs/markdown/en-US/quickstart.md index 2b80c0c91..c3639a0d2 100644 --- a/docs/markdown/en-US/quickstart.md +++ b/docs/markdown/en-US/quickstart.md @@ -34,7 +34,7 @@ import { Button } from 'vant'; #### 2. Manually import ```js -import { Button } from 'vant/lib/button'; +import Button from 'vant/lib/button'; import 'vant/lib/vant-css/base.css'; import 'vant/lib/vant-css/button.css'; ``` diff --git a/docs/markdown/zh-CN/quickstart.md b/docs/markdown/zh-CN/quickstart.md index 66249ad64..6c31efe4b 100644 --- a/docs/markdown/zh-CN/quickstart.md +++ b/docs/markdown/zh-CN/quickstart.md @@ -32,7 +32,7 @@ import { Button } from 'vant'; #### 方式二. 按需引入组件 ```js -import { Button } from 'vant/lib/button'; +import Button from 'vant/lib/button'; import 'vant/lib/vant-css/base.css'; import 'vant/lib/vant-css/button.css'; ``` From 6f52b59d50ed6ddfac0823b972f722795e38ff8e Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 9 Feb 2018 16:38:44 +0800 Subject: [PATCH 05/41] [Doc] add build-in style document (#633) --- docs/demos/index.js | 1 + docs/demos/views/built-in-style.vue | 85 +++++++++++++++++++++++ docs/demos/views/coupon.vue | 2 +- docs/markdown/en-US/built-in-style.md | 48 +++++++++++++ docs/markdown/en-US/coupon.md | 4 +- docs/markdown/index.js | 2 + docs/markdown/zh-CN/built-in-style.md | 47 +++++++++++++ docs/markdown/zh-CN/coupon.md | 5 +- docs/src/WapApp.vue | 7 +- docs/src/doc.config.js | 8 +++ docs/src/examples.js | 2 +- docs/src/index.js | 2 +- docs/src/{router.config.js => router.js} | 15 ++-- packages/switch-cell/index.vue | 3 +- packages/vant-css/src/common/hairline.css | 18 ++--- 15 files changed, 216 insertions(+), 33 deletions(-) create mode 100644 docs/demos/views/built-in-style.vue create mode 100644 docs/markdown/en-US/built-in-style.md create mode 100644 docs/markdown/zh-CN/built-in-style.md rename docs/src/{router.config.js => router.js} (90%) diff --git a/docs/demos/index.js b/docs/demos/index.js index a3c210b92..8e85dba4b 100644 --- a/docs/demos/index.js +++ b/docs/demos/index.js @@ -26,6 +26,7 @@ export default { 'address-list': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/address-list'), 'address-list')), 'address-list')), 'area': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/area'), 'area')), 'area')), 'badge': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/badge'), 'badge')), 'badge')), + 'built-in-style': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/built-in-style'), 'built-in-style')), 'built-in-style')), 'button': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/button'), 'button')), 'button')), 'card': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/card'), 'card')), 'card')), 'cell-swipe': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/cell-swipe'), 'cell-swipe')), 'cell-swipe')), diff --git a/docs/demos/views/built-in-style.vue b/docs/demos/views/built-in-style.vue new file mode 100644 index 000000000..1c1a6a670 --- /dev/null +++ b/docs/demos/views/built-in-style.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/docs/demos/views/coupon.vue b/docs/demos/views/coupon.vue index 05d94ce14..d88d3a3da 100644 --- a/docs/demos/views/coupon.vue +++ b/docs/demos/views/coupon.vue @@ -115,7 +115,7 @@ export default { }); }, randomId(max = 999999) { - return Math.floor(Math.random() * max) + 1 + return Math.floor(Math.random() * max) + 1; } } }; diff --git a/docs/markdown/en-US/built-in-style.md b/docs/markdown/en-US/built-in-style.md new file mode 100644 index 000000000..b2192ac72 --- /dev/null +++ b/docs/markdown/en-US/built-in-style.md @@ -0,0 +1,48 @@ +## Built-in Style +Vant contains some common styles that can be used directly by the className. + +### Text ellipsis +When the text content length exceeds the maximum container width, the excess text is automatically omitted. + +```html +
+ This is a paragraph of 250px width limit, the back will be omitted. +
+``` + +### Hairline +Add 1px border under the Retina screen for the element, based on a pseudo element. + +```html + +
+ + +
+ + +
+ + +
+ + +
+ + +
+``` + +### Animation + +```html + + +
Fade
+
+ + + +
Fade
+
+``` \ No newline at end of file diff --git a/docs/markdown/en-US/coupon.md b/docs/markdown/en-US/coupon.md index 8c3f9a091..ae927e837 100644 --- a/docs/markdown/en-US/coupon.md +++ b/docs/markdown/en-US/coupon.md @@ -107,8 +107,8 @@ export default { | discount | Discount | `Number` | | denominations | Denominations | `Number` | | origin_condition | Condition | `Number` | -| start_at | Start time | `Number` | -| end_at | End time | `Number` | +| start_at | Start time (Timestmap, unit second) | `Number` | +| end_at | End time (Timestmap, unit second) | `Number` | | reason | Unavailable reason | `String` | | value | Value | `Number` | diff --git a/docs/markdown/index.js b/docs/markdown/index.js index e5108c2a8..16830af2c 100644 --- a/docs/markdown/index.js +++ b/docs/markdown/index.js @@ -18,6 +18,7 @@ export default { 'zh-CN/address-list': wrapper(r => require.ensure([], () => r(require('./zh-CN/address-list.md')), 'zh-CN/address-list')), 'zh-CN/area': wrapper(r => require.ensure([], () => r(require('./zh-CN/area.md')), 'zh-CN/area')), 'zh-CN/badge': wrapper(r => require.ensure([], () => r(require('./zh-CN/badge.md')), 'zh-CN/badge')), + 'zh-CN/built-in-style': wrapper(r => require.ensure([], () => r(require('./zh-CN/built-in-style.md')), 'zh-CN/built-in-style')), 'zh-CN/button': wrapper(r => require.ensure([], () => r(require('./zh-CN/button.md')), 'zh-CN/button')), 'zh-CN/card': wrapper(r => require.ensure([], () => r(require('./zh-CN/card.md')), 'zh-CN/card')), 'zh-CN/cell-swipe': wrapper(r => require.ensure([], () => r(require('./zh-CN/cell-swipe.md')), 'zh-CN/cell-swipe')), @@ -72,6 +73,7 @@ export default { 'en-US/address-list': wrapper(r => require.ensure([], () => r(require('./en-US/address-list.md')), 'en-US/address-list')), 'en-US/area': wrapper(r => require.ensure([], () => r(require('./en-US/area.md')), 'en-US/area')), 'en-US/badge': wrapper(r => require.ensure([], () => r(require('./en-US/badge.md')), 'en-US/badge')), + 'en-US/built-in-style': wrapper(r => require.ensure([], () => r(require('./en-US/built-in-style.md')), 'en-US/built-in-style')), 'en-US/button': wrapper(r => require.ensure([], () => r(require('./en-US/button.md')), 'en-US/button')), 'en-US/card': wrapper(r => require.ensure([], () => r(require('./en-US/card.md')), 'en-US/card')), 'en-US/cell-swipe': wrapper(r => require.ensure([], () => r(require('./en-US/cell-swipe.md')), 'en-US/cell-swipe')), diff --git a/docs/markdown/zh-CN/built-in-style.md b/docs/markdown/zh-CN/built-in-style.md new file mode 100644 index 000000000..c779ef945 --- /dev/null +++ b/docs/markdown/zh-CN/built-in-style.md @@ -0,0 +1,47 @@ +## 内置样式 +Vant 中默认包含了一些常用样式,可以直接通过 className 的方式使用。 + +### 文字省略 +当文本内容长度超过容器最大宽度时,自动省略多余的文本。 + +```html +
这是一段宽度限制 250px 的文字,后面的内容会省略
+``` + +### 1px 边框 +为元素添加 Retina 屏幕下的 1px 边框(即 hairline),基于伪类 transform 实现。 + +```html + +
+ + +
+ + +
+ + +
+ + +
+ + +
+``` + +### 动画 +可以通过 `transition` 组件使用内置的动画 + +```html + + +
Fade
+
+ + + +
Fade
+
+``` \ No newline at end of file diff --git a/docs/markdown/zh-CN/coupon.md b/docs/markdown/zh-CN/coupon.md index dac310fcc..55c089fa5 100644 --- a/docs/markdown/zh-CN/coupon.md +++ b/docs/markdown/zh-CN/coupon.md @@ -110,8 +110,7 @@ export default { | discount | 折扣(0为满减券)88=>8.8折 | `Number` | | denominations | 面值(0为折扣券)单位分 | `Number` | | origin_condition | 满减条件(0为无门槛,满XX元可用)单位分 | `Number` | -| start_at | 卡有效开始时间 | `Number` | -| end_at | 卡失效日期 | `Number` | +| start_at | 卡有效开始时间 (时间戳, 单位秒) | `Number` | +| end_at | 卡失效日期 (时间戳, 单位秒) | `Number` | | reason | 不可用原因 | `String` | | value | 订单优惠金额,单位分 | `Number` | - diff --git a/docs/src/WapApp.vue b/docs/src/WapApp.vue index a8ac5faa2..1155dadf2 100644 --- a/docs/src/WapApp.vue +++ b/docs/src/WapApp.vue @@ -6,7 +6,6 @@ class="van-doc-nav-bar" :title="title" left-arrow - :left-text="$t('back')" @click-left="onBack" /> @@ -14,13 +13,11 @@ From e0664d7f825d8ee11e3772d58a8eb16bfceee50a Mon Sep 17 00:00:00 2001 From: MaStone Date: Fri, 9 Feb 2018 20:49:38 +0800 Subject: [PATCH 07/41] [new feature] Checkbox: support config the maximum amount of checked options (#631) --- docs/demos/views/checkbox.vue | 19 ++++++++++++++++--- docs/markdown/en-US/checkbox.md | 25 +++++++++++++++++++++++++ docs/markdown/zh-CN/checkbox.md | 28 ++++++++++++++++++++++++++++ packages/checkbox-group/index.vue | 6 +++++- packages/checkbox/index.vue | 9 +++++++-- test/unit/components/checkbox.vue | 5 +++-- test/unit/specs/checkbox.spec.js | 17 +++++++++++++++++ 7 files changed, 101 insertions(+), 8 deletions(-) diff --git a/docs/demos/views/checkbox.vue b/docs/demos/views/checkbox.vue index 0365eda15..77363778b 100644 --- a/docs/demos/views/checkbox.vue +++ b/docs/demos/views/checkbox.vue @@ -30,6 +30,16 @@ + + + + + + {{ $t('checkbox') }} {{ item }} + + + + @@ -39,12 +49,14 @@ export default { 'zh-CN': { checkbox: '复选框', title3: 'Checkbox 组', - title4: '与 Cell 组件一起使用' + title4: '与 Cell 组件一起使用', + title5: '设置最大可选数', }, 'en-US': { checkbox: 'Checkbox', title3: 'Checkbox Group', - title4: 'Inside a Cell' + title4: 'Inside a Cell', + title5: 'Configure the maximum amount of checked options' } }, @@ -57,7 +69,8 @@ export default { 'b', 'c' ], - result: ['a', 'b'] + result: ['a', 'b'], + max: 2 }; } }; diff --git a/docs/markdown/en-US/checkbox.md b/docs/markdown/en-US/checkbox.md index 9cb5f436b..4ae5b3621 100644 --- a/docs/markdown/en-US/checkbox.md +++ b/docs/markdown/en-US/checkbox.md @@ -69,6 +69,30 @@ export default { ``` +#### Configure the maximum amount of checked options + +```html + + + + Checkbox {{ item }} + + + +``` + +``` +export default { + data() { + return { + list: ['a', 'b', 'c'], + result: ['a', 'b'], + max: 2 + }; + } +}; +``` + ### Checkbox API | Attribute | Description | Type | Default | Accepted Values | @@ -82,6 +106,7 @@ export default { | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| | disabled | Disable all checkboxes | `Boolean` | `false` | - | +| max | the maximum amount of checked options | `Number` | `0`(Unlimited) | - | ### Checkbox Event diff --git a/docs/markdown/zh-CN/checkbox.md b/docs/markdown/zh-CN/checkbox.md index 3a6fb9d52..add620c02 100644 --- a/docs/markdown/zh-CN/checkbox.md +++ b/docs/markdown/zh-CN/checkbox.md @@ -73,6 +73,33 @@ export default { ``` +#### 设置最大可选数 + +此时你需要引入`CellGroup`组件,`Cell`组件非必须 + +```html + + + + 复选框 {{ item }} + + + +``` + +``` +export default { + data() { + return { + list: ['a', 'b', 'c'], + result: ['a', 'b'], + max: 2 + }; + } +}; +``` + + ### Checkbox API | 参数 | 说明 | 类型 | 默认值 | 可选值 | @@ -86,6 +113,7 @@ export default { | 参数 | 说明 | 类型 | 默认值 | 可选值 | |-----------|-----------|-----------|-------------|-------------| | disabled | 是否禁用所有单选框 | `Boolean` | `false` | - | +| max | 设置最大可选数 | `Number` | `0`(无限制) | - | ### Checkbox Event diff --git a/packages/checkbox-group/index.vue b/packages/checkbox-group/index.vue index f544f2774..9c00e3d78 100644 --- a/packages/checkbox-group/index.vue +++ b/packages/checkbox-group/index.vue @@ -12,7 +12,11 @@ export default create({ props: { value: {}, - disabled: Boolean + disabled: Boolean, + max: { + default: 0, + type: Number + } }, watch: { diff --git a/packages/checkbox/index.vue b/packages/checkbox/index.vue index cc4730d8f..afb85de2d 100644 --- a/packages/checkbox/index.vue +++ b/packages/checkbox/index.vue @@ -3,7 +3,7 @@ class="van-checkbox" :class="[ `van-checkbox--${shape}`, - { 'van-checkbox--disabled': isDisabled } + { 'van-checkbox--disabled': isDisabled || isLimit } ]" > @@ -90,7 +90,12 @@ export default create({ }, isDisabled() { - return (this.isGroup && this.parentGroup && this.parentGroup.disabled) || this.disabled; + return (this.isGroup && this.parentGroup && this.parentGroup.disabled) || this.disabled || + (this.isGroup && this.parentGroup && this.parentGroup.max > 0 && this.parentGroup.max <= this.parentGroup.value.length && !this.isChecked); + }, + + isLimit() { + return this.isGroup && this.parentGroup && this.parentGroup.max > 0 && this.parentGroup.max <= this.parentGroup.value.length; } }, diff --git a/test/unit/components/checkbox.vue b/test/unit/components/checkbox.vue index 0b824248a..1b8cfd1c4 100644 --- a/test/unit/components/checkbox.vue +++ b/test/unit/components/checkbox.vue @@ -1,5 +1,5 @@ @@ -22,7 +22,8 @@ export default { 'c', 'd' ], - result: ['a', 'b'] + result: ['a', 'b'], + max: 0 }; } }; diff --git a/test/unit/specs/checkbox.spec.js b/test/unit/specs/checkbox.spec.js index 110032883..5e4df1c11 100644 --- a/test/unit/specs/checkbox.spec.js +++ b/test/unit/specs/checkbox.spec.js @@ -67,6 +67,23 @@ describe('CheckboxGroup', () => { }); }); + it('click on unchecked item and checked options num beyond max', (done) => { + wrapper = mount(CheckboxTestComponent); + + wrapper.setData({ + 'max': 2 + }); + + const lastCheckboxLabel = wrapper.find('.van-checkbox')[3].find('.van-checkbox__label')[0]; + lastCheckboxLabel.trigger('click'); + + wrapper.update(); + wrapper.vm.$nextTick(() => { + expect(wrapper.vm.result.indexOf('d')).to.equal(-1); + done(); + }); + }); + it('click on disabled item', (done) => { wrapper = mount(CheckboxTestComponent); From a2f0ebdf8b57ac220f1d596fed5277abd951d0bc Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 11 Feb 2018 17:01:15 +0800 Subject: [PATCH 08/41] [bugfix] Stepper: change event error when clear input (#635) --- docs/src/WapApp.vue | 3 ++- packages/stepper/index.vue | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/src/WapApp.vue b/docs/src/WapApp.vue index 1155dadf2..e9ac81bd7 100644 --- a/docs/src/WapApp.vue +++ b/docs/src/WapApp.vue @@ -2,9 +2,9 @@
@@ -40,6 +40,7 @@ body { .van-doc-nav-bar { .van-nav-bar__title { + font-size: 15px; text-transform: capitalize; } } diff --git a/packages/stepper/index.vue b/packages/stepper/index.vue index 8bf207c59..7b925c0e3 100644 --- a/packages/stepper/index.vue +++ b/packages/stepper/index.vue @@ -79,9 +79,11 @@ export default create({ watch: { value(val) { - val = this.correctValue(+val); - if (val !== this.currentValue) { - this.currentValue = val; + if (val !== '') { + val = this.correctValue(+val); + if (val !== this.currentValue) { + this.currentValue = val; + } } } }, @@ -99,8 +101,8 @@ export default create({ }, onInput(event) { - const val = +event.target.value; - this.currentValue = this.correctValue(val); + const { value } = event.target; + this.currentValue = value ? this.correctValue(+value) : value; this.emitInput(); }, From f519bb269d7d953b5c7d25bf07c68c896303dd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 12 Feb 2018 10:34:00 +0800 Subject: [PATCH 09/41] update dependencies --- package.json | 8 +++--- yarn.lock | 75 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 55 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 92ecde1ef..e2ed3ab68 100644 --- a/package.json +++ b/package.json @@ -44,13 +44,13 @@ "license": "MIT", "dependencies": { "babel-runtime": "6.x", - "vue-lazyload": "^1.1.4" + "vue-lazyload": "^1.2.0" }, "peerDependencies": { "vue": ">= 2.5.0" }, "devDependencies": { - "autoprefixer": "^7.2.5", + "autoprefixer": "^8.0.0", "avoriaz": "2.0.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", @@ -85,7 +85,7 @@ "postcss": "^6.0.17", "postcss-calc": "^6.0.0", "postcss-easy-import": "^3.0.0", - "postcss-loader": "^2.0.10", + "postcss-loader": "^2.1.0", "precss": "2.0.0", "progress-bar-webpack-plugin": "^1.10.0", "rimraf": "^2.5.4", @@ -103,7 +103,7 @@ "vue-style-loader": "^3.1.2", "vue-template-compiler": "^2.5.13", "vue-template-es2015-compiler": "^1.6.0", - "webpack": "^3.10.0", + "webpack": "^3.11.0", "webpack-bundle-analyzer": "^2.10.0", "webpack-dev-server": "2.11.1", "webpack-merge": "^4.1.1" diff --git a/yarn.lock b/yarn.lock index 5ecff5042..c49be0109 100644 --- a/yarn.lock +++ b/yarn.lock @@ -56,10 +56,14 @@ after@0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" -ajv-keywords@^2.0.0, ajv-keywords@^2.1.0: +ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" +ajv-keywords@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" + ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -67,7 +71,7 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5, ajv@^5.2.3, ajv@^5.3.0: +ajv@^5.0.0, ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: @@ -76,6 +80,14 @@ ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5, ajv@^5.2.3, ajv@^5.3.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +ajv@^6.1.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.1.1.tgz#978d597fbc2b7d0e5a5c3ddeb149a682f2abfa0e" + dependencies: + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -307,15 +319,15 @@ autoprefixer@^6.3.1: postcss "^5.2.16" postcss-value-parser "^3.2.3" -autoprefixer@^7.2.5: - version "7.2.5" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-7.2.5.tgz#04ccbd0c6a61131b6d13f53d371926092952d192" +autoprefixer@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.0.0.tgz#c19e480f061013127c373df0b01cf46919943f74" dependencies: - browserslist "^2.11.1" - caniuse-lite "^1.0.30000791" + browserslist "^3.0.0" + caniuse-lite "^1.0.30000808" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^6.0.16" + postcss "^6.0.17" postcss-value-parser "^3.2.3" avoriaz@2.0.0: @@ -1100,13 +1112,20 @@ browserslist@^1.3.6, browserslist@^1.5.2, browserslist@^1.7.6: caniuse-db "^1.0.30000639" electron-to-chromium "^1.2.7" -browserslist@^2.1.2, browserslist@^2.11.1: +browserslist@^2.1.2: version "2.11.3" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.11.3.tgz#fe36167aed1bbcde4827ebfe71347a2cc70b99b2" dependencies: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" +browserslist@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.0.0.tgz#5b41520c1a5ce6d0d2fe7c44bdf30e526b650403" + dependencies: + caniuse-lite "^1.0.30000807" + electron-to-chromium "^1.3.33" + buffer-indexof@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-indexof/-/buffer-indexof-1.1.1.tgz#52fabcc6a606d1a00302802648ef68f639da268c" @@ -1219,10 +1238,14 @@ caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: version "1.0.30000793" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000793.tgz#3c00c66e423a7a1907c7dd96769a78b2afa8a72e" -caniuse-lite@^1.0.30000791, caniuse-lite@^1.0.30000792: +caniuse-lite@^1.0.30000792: version "1.0.30000792" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000792.tgz#d0cea981f8118f3961471afbb43c9a1e5bbf0332" +caniuse-lite@^1.0.30000807, caniuse-lite@^1.0.30000808: + version "1.0.30000808" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000808.tgz#7d759b5518529ea08b6705a19e70dbf401628ffc" + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -2171,6 +2194,10 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.30: version "1.3.31" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.31.tgz#00d832cba9fe2358652b0c48a8816c8e3a037e9f" +electron-to-chromium@^1.3.33: + version "1.3.33" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.33.tgz#bf00703d62a7c65238136578c352d6c5c042a545" + elliptic@^6.0.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" @@ -5288,14 +5315,14 @@ postcss-load-plugins@^2.3.0: cosmiconfig "^2.1.1" object-assign "^4.1.0" -postcss-loader@^2.0.10: - version "2.0.10" - resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.0.10.tgz#090db0540140bd56a7a7f717c41bc29aeef4c674" +postcss-loader@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.0.tgz#038c2d6d59753fef4667827fd3ae03f5dc5e6a7a" dependencies: loader-utils "^1.1.0" postcss "^6.0.0" postcss-load-config "^1.2.0" - schema-utils "^0.3.0" + schema-utils "^0.4.0" postcss-media-minmax@^3.0.0: version "3.0.0" @@ -5538,7 +5565,7 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0 source-map "^0.5.6" supports-color "^3.2.3" -postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.14, postcss@^6.0.16, postcss@^6.0.3, postcss@^6.0.8, postcss@^6.0.9: +postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.14, postcss@^6.0.3, postcss@^6.0.8, postcss@^6.0.9: version "6.0.16" resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.16.tgz#112e2fe2a6d2109be0957687243170ea5589e146" dependencies: @@ -6153,7 +6180,7 @@ schema-utils@^0.3.0: dependencies: ajv "^5.0.0" -schema-utils@^0.4.2, schema-utils@^0.4.3: +schema-utils@^0.4.0, schema-utils@^0.4.2, schema-utils@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.3.tgz#e2a594d3395834d5e15da22b48be13517859458e" dependencies: @@ -7148,9 +7175,9 @@ vue-hot-reload-api@^2.2.0: version "2.2.4" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.2.4.tgz#683bd1d026c0d3b3c937d5875679e9a87ec6cd8f" -vue-lazyload@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/vue-lazyload/-/vue-lazyload-1.1.4.tgz#94dbb3fcb047f147f37900c0e22ad4fd478e31c4" +vue-lazyload@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/vue-lazyload/-/vue-lazyload-1.2.0.tgz#f295002d14bfcad1b3eae340d211ba711b818b57" vue-loader@^14.1.1: version "14.1.1" @@ -7295,14 +7322,14 @@ webpack-sources@^1.0.1: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@^3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.10.0.tgz#5291b875078cf2abf42bdd23afe3f8f96c17d725" +webpack@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.11.0.tgz#77da451b1d7b4b117adaf41a1a93b5742f24d894" dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0" - ajv "^5.1.5" - ajv-keywords "^2.0.0" + ajv "^6.1.0" + ajv-keywords "^3.1.0" async "^2.1.2" enhanced-resolve "^3.4.0" escope "^3.6.0" From 9673da41311805034ba60ca82fdbe163046e915d Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 12 Feb 2018 10:35:20 +0800 Subject: [PATCH 10/41] [Improvement] Checkbox: remove unnecessary DOM (#636) --- docs/demos/views/checkbox.vue | 19 ++++----- docs/markdown/en-US/checkbox.md | 43 ++++++++----------- docs/markdown/zh-CN/checkbox.md | 45 ++++++++------------ packages/checkbox/index.vue | 66 ++++++++++++++---------------- packages/vant-css/src/checkbox.css | 63 +++++++++------------------- test/unit/specs/checkbox.spec.js | 2 +- 6 files changed, 93 insertions(+), 145 deletions(-) diff --git a/docs/demos/views/checkbox.vue b/docs/demos/views/checkbox.vue index 77363778b..e3962cf1b 100644 --- a/docs/demos/views/checkbox.vue +++ b/docs/demos/views/checkbox.vue @@ -32,7 +32,7 @@ - + {{ $t('checkbox') }} {{ item }} @@ -56,7 +56,7 @@ export default { checkbox: 'Checkbox', title3: 'Checkbox Group', title4: 'Inside a Cell', - title5: 'Configure the maximum amount of checked options' + title5: 'Maximum amount of checked options' } }, @@ -70,6 +70,7 @@ export default { 'c' ], result: ['a', 'b'], + result2: [], max: 2 }; } @@ -85,15 +86,13 @@ export default { .van-cell { .van-checkbox { margin: 0; - } + display: flex; + flex-direction: row-reverse; - .van-checkbox__input { - float: right; - position: static; - } - - span { - margin: 0; + &__label { + margin: 0; + flex: 1; + } } } } diff --git a/docs/markdown/en-US/checkbox.md b/docs/markdown/en-US/checkbox.md index 4ae5b3621..39c6c67ea 100644 --- a/docs/markdown/en-US/checkbox.md +++ b/docs/markdown/en-US/checkbox.md @@ -38,7 +38,7 @@ When Checkboxes are inside a CheckboxGroup, the checked checkboxes's name is an Checkbox {{ item }} @@ -57,41 +57,32 @@ export default { }; ``` +#### Maximum amount of checked options + +```html + + + Checkbox {{ item }} + + +``` + #### Inside a Cell ```html - + Checkbox {{ item }} ``` -#### Configure the maximum amount of checked options - -```html - - - - Checkbox {{ item }} - - - -``` - -``` -export default { - data() { - return { - list: ['a', 'b', 'c'], - result: ['a', 'b'], - max: 2 - }; - } -}; -``` ### Checkbox API @@ -106,7 +97,7 @@ export default { | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| | disabled | Disable all checkboxes | `Boolean` | `false` | - | -| max | the maximum amount of checked options | `Number` | `0`(Unlimited) | - | +| max | Maximum amount of checked options | `Number` | `0`(Unlimited) | - | ### Checkbox Event diff --git a/docs/markdown/zh-CN/checkbox.md b/docs/markdown/zh-CN/checkbox.md index add620c02..27cf5652a 100644 --- a/docs/markdown/zh-CN/checkbox.md +++ b/docs/markdown/zh-CN/checkbox.md @@ -40,7 +40,7 @@ export default { 复选框 {{ item }} @@ -59,6 +59,20 @@ export default { }; ``` +#### 设置最大可选数 + +```html + + + 复选框 {{ item }} + + +``` + #### 与 Cell 组件一起使用 此时你需要再引入`Cell`和`CellGroup`组件 @@ -66,40 +80,13 @@ export default { ```html - + 复选框 {{ item }} ``` -#### 设置最大可选数 - -此时你需要引入`CellGroup`组件,`Cell`组件非必须 - -```html - - - - 复选框 {{ item }} - - - -``` - -``` -export default { - data() { - return { - list: ['a', 'b', 'c'], - result: ['a', 'b'], - max: 2 - }; - } -}; -``` - - ### Checkbox API | 参数 | 说明 | 类型 | 默认值 | 可选值 | diff --git a/packages/checkbox/index.vue b/packages/checkbox/index.vue index afb85de2d..ba92c4cc0 100644 --- a/packages/checkbox/index.vue +++ b/packages/checkbox/index.vue @@ -1,28 +1,23 @@ diff --git a/test/components/checkbox.vue b/test/components/checkbox.vue index 1b8cfd1c4..4da1ce266 100644 --- a/test/components/checkbox.vue +++ b/test/components/checkbox.vue @@ -1,19 +1,11 @@ - diff --git a/test/components/goods-action.vue b/test/components/goods-action.vue index bf867989c..a2973e5f0 100644 --- a/test/components/goods-action.vue +++ b/test/components/goods-action.vue @@ -1,37 +1,16 @@ - - diff --git a/test/components/more-tabs.vue b/test/components/more-tabs.vue index 6313f92ca..52373eed7 100644 --- a/test/components/more-tabs.vue +++ b/test/components/more-tabs.vue @@ -12,15 +12,7 @@ - diff --git a/test/components/number-keyboard.vue b/test/components/number-keyboard.vue index b6cd28b8d..4deeec5df 100644 --- a/test/components/number-keyboard.vue +++ b/test/components/number-keyboard.vue @@ -5,15 +5,9 @@ diff --git a/test/components/radio.vue b/test/components/radio.vue index 9b22e700d..d248fd799 100644 --- a/test/components/radio.vue +++ b/test/components/radio.vue @@ -4,17 +4,9 @@ 单选框2 - + diff --git a/test/components/steps.vue b/test/components/steps.vue index 917ae2235..348c72f92 100644 --- a/test/components/steps.vue +++ b/test/components/steps.vue @@ -8,15 +8,7 @@ - + + diff --git a/package.json b/package.json index 6c8267485..04265543d 100644 --- a/package.json +++ b/package.json @@ -50,28 +50,28 @@ "vue": ">= 2.5.0" }, "devDependencies": { - "autoprefixer": "^8.0.0", + "autoprefixer": "^8.1.0", "avoriaz": "2.0.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", - "babel-loader": "^7.1.2", + "babel-loader": "^7.1.3", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-runtime": "^6.15.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.1", - "cache-loader": "^1.2.0", + "cache-loader": "^1.2.2", "chai": "^4.1.2", "codecov": "^3.0.0", "cross-env": "^5.1.3", - "css-loader": "^0.28.9", - "dependency-tree": "^6.0.0", - "eslint": "^4.18.1", - "eslint-plugin-vue": "^4.2.2", + "css-loader": "^0.28.10", + "dependency-tree": "^6.0.1", + "eslint": "^4.18.2", + "eslint-plugin-vue": "^4.3.0", "extract-text-webpack-plugin": "3.0.2", "fast-vue-md-loader": "^1.0.3", "friendly-errors-webpack-plugin": "^1.6.1", "gh-pages": "^1.0.0", - "html-webpack-plugin": "^2.29.0", + "html-webpack-plugin": "^3.0.4", "isparta-loader": "^2.0.0", "karma": "^1.7.1", "karma-chrome-launcher": "^2.2.0", @@ -85,7 +85,7 @@ "postcss": "^6.0.19", "postcss-calc": "^6.0.0", "postcss-easy-import": "^3.0.0", - "postcss-loader": "^2.1.0", + "postcss-loader": "^2.1.1", "precss": "2.0.0", "progress-bar-webpack-plugin": "^1.11.0", "rimraf": "^2.5.4", @@ -94,8 +94,8 @@ "sinon-chai": "^2.12.0", "style-loader": "^0.20.2", "uppercamelcase": "^3.0.0", - "url-loader": "^0.6.2", - "vant-doc": "1.0.3", + "url-loader": "^1.0.1", + "vant-doc": "1.0.4", "vue": "^2.5.13", "vue-loader": "^14.1.1", "vue-router": "^3.0.1", @@ -105,6 +105,6 @@ "vue-template-es2015-compiler": "^1.6.0", "webpack": "^3.11.0", "webpack-dev-server": "2.11.1", - "webpack-merge": "^4.1.1" + "webpack-merge": "^4.1.2" } } diff --git a/yarn.lock b/yarn.lock index b7ca44087..d7dd16644 100644 --- a/yarn.lock +++ b/yarn.lock @@ -311,15 +311,15 @@ autoprefixer@^6.3.1: postcss "^5.2.16" postcss-value-parser "^3.2.3" -autoprefixer@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.0.0.tgz#c19e480f061013127c373df0b01cf46919943f74" +autoprefixer@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.1.0.tgz#374cf35be1c0e8fce97408d876f95f66f5cb4641" dependencies: - browserslist "^3.0.0" - caniuse-lite "^1.0.30000808" + browserslist "^3.1.1" + caniuse-lite "^1.0.30000810" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^6.0.17" + postcss "^6.0.19" postcss-value-parser "^3.2.3" avoriaz@2.0.0: @@ -507,9 +507,9 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-loader@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.1.2.tgz#f6cbe122710f1aa2af4d881c6d5b54358ca24126" +babel-loader@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.1.3.tgz#ff5b440da716e9153abb946251a9ab7670037b16" dependencies: find-cache-dir "^1.0.0" loader-utils "^1.0.2" @@ -936,7 +936,7 @@ block-stream@*: dependencies: inherits "~2.0.0" -bluebird@^3.1.1, bluebird@^3.3.0, bluebird@^3.4.7: +bluebird@^3.1.1, bluebird@^3.3.0: version "3.5.1" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" @@ -1103,11 +1103,11 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" -browserslist@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.0.0.tgz#5b41520c1a5ce6d0d2fe7c44bdf30e526b650403" +browserslist@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.1.1.tgz#d380fc048bc3a33e60fb87dc135110ebaaa6320a" dependencies: - caniuse-lite "^1.0.30000807" + caniuse-lite "^1.0.30000809" electron-to-chromium "^1.3.33" buffer-indexof@^1.0.0: @@ -1152,13 +1152,13 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -cache-loader@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/cache-loader/-/cache-loader-1.2.0.tgz#cdc313ae53b3c13ce8ee0c9296cf16c736b15252" +cache-loader@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/cache-loader/-/cache-loader-1.2.2.tgz#6d5c38ded959a09cc5d58190ab5af6f73bd353f5" dependencies: - async "^2.4.1" loader-utils "^1.1.0" mkdirp "^0.5.1" + neo-async "^2.5.0" schema-utils "^0.4.2" caller-path@^0.1.0: @@ -1226,9 +1226,9 @@ caniuse-lite@^1.0.30000792: version "1.0.30000792" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000792.tgz#d0cea981f8118f3961471afbb43c9a1e5bbf0332" -caniuse-lite@^1.0.30000807, caniuse-lite@^1.0.30000808: - version "1.0.30000808" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000808.tgz#7d759b5518529ea08b6705a19e70dbf401628ffc" +caniuse-lite@^1.0.30000809, caniuse-lite@^1.0.30000810: + version "1.0.30000811" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000811.tgz#0b6e40f2efccc27bd3cb52f91ee7ca4673d77d10" caseless@~0.12.0: version "0.12.0" @@ -1703,9 +1703,9 @@ css-color-names@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" -css-loader@^0.28.9: - version "0.28.9" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.9.tgz#68064b85f4e271d7ce4c48a58300928e535d1c95" +css-loader@^0.28.10: + version "0.28.10" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.10.tgz#40282e79230f7bcb4e483efa631d670b735ebf42" dependencies: babel-code-frame "^6.26.0" css-selector-tokenizer "^0.7.0" @@ -1944,9 +1944,9 @@ depd@~1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" -dependency-tree@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/dependency-tree/-/dependency-tree-6.0.0.tgz#88577c5410356b11ddec84f457b0609a24ff5d39" +dependency-tree@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/dependency-tree/-/dependency-tree-6.0.1.tgz#c4330046894df51453f0b8e0648ebf654852167b" dependencies: commander "^2.6.0" debug "^3.1.0" @@ -2253,7 +2253,7 @@ error-stack-parser@^2.0.0: dependencies: stackframe "^1.0.3" -es-abstract@^1.7.0: +es-abstract@^1.5.1, es-abstract@^1.7.0: version "1.10.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864" dependencies: @@ -2366,11 +2366,11 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-plugin-vue@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-4.2.2.tgz#63e55c61574af8ef983328ddd2688d6389a0214b" +eslint-plugin-vue@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-4.3.0.tgz#478c6267269dbaa20f6e8b2cfae7a0ccc98c1d72" dependencies: - vue-eslint-parser "^2.0.1" + vue-eslint-parser "^2.0.3" eslint-scope@^3.7.1: version "3.7.1" @@ -2383,9 +2383,9 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@^4.18.1: - version "4.18.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.18.1.tgz#b9138440cb1e98b2f44a0d578c6ecf8eae6150b0" +eslint@^4.18.2: + version "4.18.2" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.18.2.tgz#0f81267ad1012e7d2051e186a9004cc2267b8d45" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" @@ -2422,7 +2422,7 @@ eslint@^4.18.1: semver "^5.3.0" strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^4.0.1" + table "4.0.2" text-table "~0.2.0" espree@^3.5.2: @@ -3325,16 +3325,17 @@ html-minifier@^3.2.3: relateurl "0.2.x" uglify-js "3.3.x" -html-webpack-plugin@^2.29.0: - version "2.30.1" - resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-2.30.1.tgz#7f9c421b7ea91ec460f56527d78df484ee7537d5" +html-webpack-plugin@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-3.0.4.tgz#498c10f40f99a339fbf3d87c5a80acf8cbea8e9b" dependencies: - bluebird "^3.4.7" html-minifier "^3.2.3" loader-utils "^0.2.16" lodash "^4.17.3" pretty-error "^2.0.2" + tapable "^1.0.0" toposort "^1.0.0" + util.promisify "1.0.0" htmlparser2@^3.9.1: version "3.9.2" @@ -4192,7 +4193,7 @@ lodash@3.x, lodash@^3.8.0: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@^4.0.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.5.0: +lodash@^4.0.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.5.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -4393,10 +4394,14 @@ mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" -mime@^1.3.4, mime@^1.4.1, mime@^1.5.0: +mime@^1.3.4, mime@^1.5.0: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" +mime@^2.0.3: + version "2.2.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.2.0.tgz#161e541965551d3b549fa1114391e3a3d55b923b" + mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" @@ -4556,6 +4561,10 @@ negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" +neo-async@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f" + no-case@^2.2.0: version "2.3.2" resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" @@ -4754,6 +4763,13 @@ object.assign@^4.0.1: has-symbols "^1.0.0" object-keys "^1.0.11" +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -5261,9 +5277,9 @@ postcss-load-plugins@^2.3.0: cosmiconfig "^2.1.1" object-assign "^4.1.0" -postcss-loader@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.0.tgz#038c2d6d59753fef4667827fd3ae03f5dc5e6a7a" +postcss-loader@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.1.tgz#208935af3b1d65e1abb1a870a912dd12e7b36895" dependencies: loader-utils "^1.1.0" postcss "^6.0.0" @@ -5519,14 +5535,6 @@ postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.1 source-map "^0.6.1" supports-color "^5.1.0" -postcss@^6.0.17: - version "6.0.17" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.17.tgz#e259a051ca513f81e9afd0c21f7f82eda50c65c5" - dependencies: - chalk "^2.3.0" - source-map "^0.6.1" - supports-color "^5.1.0" - postcss@^6.0.19: version "6.0.19" resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.19.tgz#76a78386f670b9d9494a655bf23ac012effd1555" @@ -6694,7 +6702,7 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" -table@^4.0.1: +table@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: @@ -6709,6 +6717,10 @@ tapable@^0.2.7: version "0.2.8" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" +tapable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.0.0.tgz#cbb639d9002eed9c6b5975eb20598d7936f1f9f2" + tar-pack@^3.4.0: version "3.4.1" resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" @@ -6984,13 +6996,13 @@ urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" -url-loader@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.6.2.tgz#a007a7109620e9d988d14bce677a1decb9a993f7" +url-loader@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-1.0.1.tgz#61bc53f1f184d7343da2728a1289ef8722ea45ee" dependencies: - loader-utils "^1.0.2" - mime "^1.4.1" - schema-utils "^0.3.0" + loader-utils "^1.1.0" + mime "^2.0.3" + schema-utils "^0.4.3" url-parse@1.0.x: version "1.0.5" @@ -7040,6 +7052,13 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +util.promisify@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + dependencies: + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" + util@0.10.3, util@^0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" @@ -7075,9 +7094,9 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" -vant-doc@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/vant-doc/-/vant-doc-1.0.3.tgz#b66727676d115e2345b89f1424c0976bfa1e4551" +vant-doc@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/vant-doc/-/vant-doc-1.0.4.tgz#518182a4f0cb52b90e430474d4b4432d95306d31" dependencies: cheerio "0.22.0" decamelize "^1.2.0" @@ -7117,9 +7136,9 @@ vue-add-globals@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/vue-add-globals/-/vue-add-globals-1.0.1.tgz#151f241426e70cbc790a1f31bb0f4435d7575efc" -vue-eslint-parser@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.2.tgz#8d603545e9d7c134699075bd1772af1ffd86b744" +vue-eslint-parser@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1" dependencies: debug "^3.1.0" eslint-scope "^3.7.1" @@ -7249,11 +7268,11 @@ webpack-dev-server@2.11.1: webpack-dev-middleware "1.12.2" yargs "6.6.0" -webpack-merge@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.1.1.tgz#f1197a0a973e69c6fbeeb6d658219aa8c0c13555" +webpack-merge@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.1.2.tgz#5d372dddd3e1e5f8874f5bf5a8e929db09feb216" dependencies: - lodash "^4.17.4" + lodash "^4.17.5" webpack-sources@^1.0.1: version "1.1.0" From 8d867ddf6d2434676f08f069eb752c8fca561232 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 5 Mar 2018 14:36:36 +0800 Subject: [PATCH 33/41] [Doc] swipe: add change event demo (#666) --- docs/demos/views/swipe.vue | 23 +++++++++++++++++++++-- docs/markdown/en-US/swipe.md | 21 +++++++++++++++++++++ docs/markdown/zh-CN/swipe.md | 21 +++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/docs/demos/views/swipe.vue b/docs/demos/views/swipe.vue index ca66d62d9..9b5e43ea8 100644 --- a/docs/demos/views/swipe.vue +++ b/docs/demos/views/swipe.vue @@ -16,6 +16,15 @@ + + + + 1 + 2 + 3 + 4 + + @@ -23,10 +32,14 @@ export default { i18n: { 'zh-CN': { - title2: '图片懒加载' + title2: '图片懒加载', + title3: '监听 change 事件', + message: '当前 Swipe 索引:' }, 'en-US': { - title2: 'Image Lazyload' + title2: 'Image Lazyload', + title3: 'Change Event', + message: 'Current Swipe index:' } }, @@ -39,6 +52,12 @@ export default { 'https://img.yzcdn.cn/public_files/2017/09/05/fd08f07665ed67d50e11b32a21ce0682.jpg' ] }; + }, + + methods: { + onChange(index) { + this.$toast(this.$t('message') + index); + } } }; diff --git a/docs/markdown/en-US/swipe.md b/docs/markdown/en-US/swipe.md index 08aa3d835..a4444023f 100644 --- a/docs/markdown/en-US/swipe.md +++ b/docs/markdown/en-US/swipe.md @@ -45,6 +45,27 @@ export default { } ``` +#### change event + +```html + + 1 + 2 + 3 + 4 + +``` + +```js +export default { + methods: { + onChange(index) { + Toast('Current Swipe index:' + index); + } + } +} +``` + ### API | Attribute | Description | Type | Default | Accepted Values | diff --git a/docs/markdown/zh-CN/swipe.md b/docs/markdown/zh-CN/swipe.md index 4fa730cd7..1e8c331f8 100644 --- a/docs/markdown/zh-CN/swipe.md +++ b/docs/markdown/zh-CN/swipe.md @@ -45,6 +45,27 @@ export default { } ``` +#### 监听 change 事件 + +```html + + 1 + 2 + 3 + 4 + +``` + +```js +export default { + methods: { + onChange(index) { + Toast('当前 Swipe 索引:' + index); + } + } +} +``` + ### API | 参数 | 说明 | 类型 | 默认值 | 可选值 | From 9027c3e8b4c816324bc72d36aa8ef2e7e14dc3e2 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 6 Mar 2018 16:21:42 +0800 Subject: [PATCH 34/41] [bugfix] Field: disabled color in safari (#669) --- packages/vant-css/src/field.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vant-css/src/field.css b/packages/vant-css/src/field.css index f5812aab7..b89ce255a 100644 --- a/packages/vant-css/src/field.css +++ b/packages/vant-css/src/field.css @@ -77,7 +77,9 @@ width: 100%; resize: none; - &[disabled] { + &:disabled { + opacity: 1; + color: $gray-darker; background-color: transparent; } } From 8e7930033ba006f7c8ad5cf20fac973e7dd8591d Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 6 Mar 2018 16:56:01 +0800 Subject: [PATCH 35/41] [new feature] Swipe: support disable loop (#670) --- docs/markdown/en-US/swipe.md | 1 + docs/markdown/zh-CN/swipe.md | 1 + packages/swipe/index.vue | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/markdown/en-US/swipe.md b/docs/markdown/en-US/swipe.md index a4444023f..5c1965515 100644 --- a/docs/markdown/en-US/swipe.md +++ b/docs/markdown/en-US/swipe.md @@ -72,6 +72,7 @@ export default { |-----------|-----------|-----------|-------------|-------------| | autoplay | Autoplay interval (ms) | `Number` | - | - | | duration | Animation duration (ms) | `Number` | `500` | - | +| loop | Whether to enable loop | `Boolean` | `true` | - | | show-indicators | Whether to show indocators | `Boolean` | `true` | - | | initial-swipe | Index of initial swipe, start from 0 | `Number` | `0` | - | diff --git a/docs/markdown/zh-CN/swipe.md b/docs/markdown/zh-CN/swipe.md index 1e8c331f8..5b0085e75 100644 --- a/docs/markdown/zh-CN/swipe.md +++ b/docs/markdown/zh-CN/swipe.md @@ -72,6 +72,7 @@ export default { |-----------|-----------|-----------|-------------|-------------| | autoplay | 自动轮播间隔,单位为 ms | `Number` | - | - | | duration | 动画时长,单位为 ms | `Number` | `500` | - | +| loop | 是否开启循环播放 | `Boolean` | `true` | - | | show-indicators | 是否显示指示器 | `Boolean` | `true` | - | | initial-swipe | 初始位置,从 0 开始算 | `Number` | `0` | - | diff --git a/packages/swipe/index.vue b/packages/swipe/index.vue index 4fc53c6d1..777ec1950 100644 --- a/packages/swipe/index.vue +++ b/packages/swipe/index.vue @@ -29,6 +29,10 @@ export default create({ props: { autoplay: Number, + loop: { + type: Boolean, + default: true + }, initialSwipe: { type: Number, default: 0 @@ -152,6 +156,14 @@ export default create({ move(move = 0, offset = 0) { const { active, count, swipes, deltaX, width } = this; + if ( + !this.loop && + ((active === 0 && (offset > 0 || move < 0)) || + (active === count - 1 && (offset < 0 || move > 0))) + ) { + return; + } + if (move) { if (active === -1) { swipes[count - 1].offset = 0; @@ -190,9 +202,9 @@ export default create({ }, getDirection(touch) { - const distanceX = Math.abs(touch.clientX - this.startX); - const distanceY = Math.abs(touch.clientY - this.startY); - return distanceX > distanceY ? 'horizontal' : distanceX < distanceY ? 'vertical' : ''; + const offsetX = Math.abs(touch.clientX - this.startX); + const offsetY = Math.abs(touch.clientY - this.startY); + return offsetX > offsetY ? 'horizontal' : offsetX < offsetY ? 'vertical' : ''; }, range(num, arr) { From 00b542a5987eaebc3e38d85d19b6f7597996124b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Tue, 6 Mar 2018 17:38:08 +0800 Subject: [PATCH 36/41] [build] 0.12.12 --- packages/index.js | 2 +- packages/vant-css/package-lock.json | 2 +- packages/vant-css/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/index.js b/packages/index.js index a6ec3092f..617e5d63f 100644 --- a/packages/index.js +++ b/packages/index.js @@ -63,7 +63,7 @@ import TreeSelect from './tree-select'; import Uploader from './uploader'; import Waterfall from './waterfall'; -const version = '0.12.11'; +const version = '0.12.12'; const components = [ Actionsheet, AddressEdit, diff --git a/packages/vant-css/package-lock.json b/packages/vant-css/package-lock.json index d3bdace4c..060f0866d 100644 --- a/packages/vant-css/package-lock.json +++ b/packages/vant-css/package-lock.json @@ -1,6 +1,6 @@ { "name": "vant-css", - "version": "0.12.11", + "version": "0.12.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/vant-css/package.json b/packages/vant-css/package.json index d85b152d1..257763eab 100644 --- a/packages/vant-css/package.json +++ b/packages/vant-css/package.json @@ -1,6 +1,6 @@ { "name": "vant-css", - "version": "0.12.11", + "version": "0.12.12", "description": "vant css.", "main": "lib/index.css", "style": "lib/index.css", From 8501c8f7c2e3573d92039000e655b811fcb97ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Tue, 6 Mar 2018 17:38:08 +0800 Subject: [PATCH 37/41] [release] 0.12.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 04265543d..63e064530 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.12.11", + "version": "0.12.12", "description": "A Vue.js 2.0 Mobile UI at YouZan", "main": "lib/vant.js", "style": "lib/vant-css/index.css", From 2aaf07441675a7d6f9d782fa48ecbc3a2ab9f522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Tue, 6 Mar 2018 17:55:31 +0800 Subject: [PATCH 38/41] [changelog] 0.12.12 --- docs/markdown/en-US/changelog.md | 15 +++++++++++++ docs/markdown/zh-CN/changelog-generated.md | 25 ++++++++++++++++++++++ docs/markdown/zh-CN/changelog.md | 14 ++++++++++++ 3 files changed, 54 insertions(+) diff --git a/docs/markdown/en-US/changelog.md b/docs/markdown/en-US/changelog.md index faaafd76e..840236a04 100644 --- a/docs/markdown/en-US/changelog.md +++ b/docs/markdown/en-US/changelog.md @@ -1,5 +1,20 @@ ## Changelog +### [0.12.12](https://github.com/youzan/vant/tree/v0.12.12) +`2018-03-06` + +**Improvements** + +* Swipe: support disable loop [\#670](https://github.com/youzan/vant/pull/670) [@chenjiahan](https://github.com/chenjiahan) +* Document: add swipe change event demo [\#666](https://github.com/youzan/vant/pull/666) [@chenjiahan](https://github.com/chenjiahan) +* update static source CDN domain [\#652](https://github.com/youzan/vant/pull/652) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** + +* fix Field disabled color in safari [\#669](https://github.com/youzan/vant/pull/669) [@chenjiahan](https://github.com/chenjiahan) +* fix Swipe autoplay not stop when value set to 0 [\#660](https://github.com/youzan/vant/pull/660) [@chenjiahan](https://github.com/chenjiahan) + + ### [0.12.11](https://github.com/youzan/vant/tree/v0.12.11) `2018-02-27` diff --git a/docs/markdown/zh-CN/changelog-generated.md b/docs/markdown/zh-CN/changelog-generated.md index 24ebf9ec2..5d1af228a 100644 --- a/docs/markdown/zh-CN/changelog-generated.md +++ b/docs/markdown/zh-CN/changelog-generated.md @@ -1,5 +1,30 @@ ## 更新日志 +## [v0.12.12](https://github.com/youzan/vant/tree/v0.12.12) (2018-03-06) +[Full Changelog](https://github.com/youzan/vant/compare/v0.12.11...v0.12.12) + +**Issue** + +- Tabs 组件的sticky设置 [\#662](https://github.com/youzan/vant/issues/662) +- Sku组件有问题 [\#659](https://github.com/youzan/vant/issues/659) +- checkbox/radio选项不支持溢出文本 [\#658](https://github.com/youzan/vant/issues/658) +- Search组件输入内容在 iphone 内显示不完整 [\#657](https://github.com/youzan/vant/issues/657) +- van-button组件在loading时,loading图标不居中 [\#655](https://github.com/youzan/vant/issues/655) +- 建议增加Scroller组件,能够无限加载,下拉刷新 [\#654](https://github.com/youzan/vant/issues/654) +- Icon 浏览器兼容 [\#653](https://github.com/youzan/vant/issues/653) +- Popup以及Picker同时使用时存在的一个问题,是否能考虑在Popup点击遮罩层关闭时提供相应的事件 [\#646](https://github.com/youzan/vant/issues/646) +- 新增加的功能 [\#643](https://github.com/youzan/vant/issues/643) + +**Improvements** + +- \[new feature\] Swipe: support disable loop [\#670](https://github.com/youzan/vant/pull/670) ([chenjiahan](https://github.com/chenjiahan)) +- \[bugfix\] Field: disabled color in safari [\#669](https://github.com/youzan/vant/pull/669) ([chenjiahan](https://github.com/chenjiahan)) +- \[Doc\] swipe: add change event demo [\#666](https://github.com/youzan/vant/pull/666) ([chenjiahan](https://github.com/chenjiahan)) +- \[Doc\] fix Tab demo & update dependencies [\#665](https://github.com/youzan/vant/pull/665) ([chenjiahan](https://github.com/chenjiahan)) +- \[Improvement\] optimize utils [\#661](https://github.com/youzan/vant/pull/661) ([chenjiahan](https://github.com/chenjiahan)) +- \[bugfix\] Swipe: autoplay not stop when value set to 0 [\#660](https://github.com/youzan/vant/pull/660) ([chenjiahan](https://github.com/chenjiahan)) +- \[Improvement\] update CDN domain [\#652](https://github.com/youzan/vant/pull/652) ([chenjiahan](https://github.com/chenjiahan)) + ## [v0.12.11](https://github.com/youzan/vant/tree/v0.12.11) (2018-02-27) [Full Changelog](https://github.com/youzan/vant/compare/v0.12.10...v0.12.11) diff --git a/docs/markdown/zh-CN/changelog.md b/docs/markdown/zh-CN/changelog.md index cf741bf16..bbb808e03 100644 --- a/docs/markdown/zh-CN/changelog.md +++ b/docs/markdown/zh-CN/changelog.md @@ -1,5 +1,19 @@ ## 更新日志 +### [0.12.12](https://github.com/youzan/vant/tree/v0.12.12) +`2018-03-06` + +**Improvements** + +* Swipe: 新增 loop 属性,支持禁用循环滚动 [\#670](https://github.com/youzan/vant/pull/670) [@chenjiahan](https://github.com/chenjiahan) +* Document: 新增 change 事件示例 [\#666](https://github.com/youzan/vant/pull/666) [@chenjiahan](https://github.com/chenjiahan) +* 更新静态资源 CDN 域名 [\#652](https://github.com/youzan/vant/pull/652) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** + +* 修复 Field 在 safari 下禁用态颜色过浅的问题 [\#669](https://github.com/youzan/vant/pull/669) [@chenjiahan](https://github.com/chenjiahan) +* 修复 Swipe autoplay 设置为 0 时不会立刻取消的问题 [\#660](https://github.com/youzan/vant/pull/660) [@chenjiahan](https://github.com/chenjiahan) + ### [0.12.11](https://github.com/youzan/vant/tree/v0.12.11) `2018-02-27` From 04825584716a26fea4eab5b05b0a7a640c8342cd Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 7 Mar 2018 16:23:10 +0800 Subject: [PATCH 39/41] [new feature] AddressEdit support custom tel validator (#673) --- docs/markdown/en-US/address-edit.md | 1 + docs/markdown/en-US/contact.md | 1 + docs/markdown/zh-CN/address-edit.md | 1 + docs/markdown/zh-CN/contact.md | 1 + packages/address-edit/index.vue | 6 +++++- packages/contact-edit/index.vue | 6 +++++- 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/markdown/en-US/address-edit.md b/docs/markdown/en-US/address-edit.md index 413621337..e5842ed54 100644 --- a/docs/markdown/en-US/address-edit.md +++ b/docs/markdown/en-US/address-edit.md @@ -68,6 +68,7 @@ export default { | show-search-result | Whether to show address search result | `Boolean` | `false` | - | | is-saving | Whether to show save button loading status | `Boolean` | `false` | - | | is-deleting | Whether to show delete button loading status | `Boolean` | `false` | - | +| tel-validator | The method to validate tel | `(tel: string) => boolean` | - | - | ### Event diff --git a/docs/markdown/en-US/contact.md b/docs/markdown/en-US/contact.md index 26f8b9921..dedabda9e 100644 --- a/docs/markdown/en-US/contact.md +++ b/docs/markdown/en-US/contact.md @@ -161,6 +161,7 @@ export default { | is-edit | Whether is editing | `Boolean` | `false` | - | | is-saving | Whether to show save button loading status | `Boolean` | `false` | - | | is-deleting | Whether to show delete button loading status | `Boolean` | `false` | - | +| tel-validator | The method to validate tel | `(tel: string) => boolean` | - | - | ### ContactEdit Event diff --git a/docs/markdown/zh-CN/address-edit.md b/docs/markdown/zh-CN/address-edit.md index 284da50e8..ecdfdf24b 100644 --- a/docs/markdown/zh-CN/address-edit.md +++ b/docs/markdown/zh-CN/address-edit.md @@ -67,6 +67,7 @@ export default { | show-search-result | 是否显示搜索结果 | `Boolean` | `false` | - | | is-saving | 是否显示保存按钮加载动画 | `Boolean` | `false` | - | | is-deleting | 是否显示删除按钮加载动画 | `Boolean` | `false` | - | +| tel-validator | 手机号格式校验函数 | `(tel: string) => boolean` | - | - | ### Event diff --git a/docs/markdown/zh-CN/contact.md b/docs/markdown/zh-CN/contact.md index c839f1fc8..1daf259d8 100644 --- a/docs/markdown/zh-CN/contact.md +++ b/docs/markdown/zh-CN/contact.md @@ -162,6 +162,7 @@ export default { | is-edit | 是否为编辑联系人 | `Boolean` | `false` | - | | is-saving | 是否显示保存按钮加载动画 | `Boolean` | `false` | - | | is-deleting | 是否显示删除按钮加载动画 | `Boolean` | `false` | - | +| tel-validator | 手机号格式校验函数 | `(tel: string) => boolean` | - | - | ### ContactEdit Event diff --git a/packages/address-edit/index.vue b/packages/address-edit/index.vue index 236fbc133..56d9de8a2 100644 --- a/packages/address-edit/index.vue +++ b/packages/address-edit/index.vue @@ -126,6 +126,10 @@ export default create({ searchResult: { type: Array, default: () => [] + }, + telValidator: { + type: Function, + default: validateMobile } }, @@ -233,7 +237,7 @@ export default create({ case 'name': return value ? value.length <= 15 ? '' : $t('nameOverlimit') : $t('nameEmpty'); case 'tel': - return validateMobile(value) ? '' : $t('telWrong'); + return this.telValidator(value) ? '' : $t('telWrong'); case 'area_code': return value ? +value !== -1 ? '' : $t('areaWrong') : $t('areaEmpty'); case 'address_detail': diff --git a/packages/contact-edit/index.vue b/packages/contact-edit/index.vue index 123f8ffb3..8283f9cc7 100644 --- a/packages/contact-edit/index.vue +++ b/packages/contact-edit/index.vue @@ -54,6 +54,10 @@ export default create({ tel: '', name: '' }) + }, + telValidator: { + type: Function, + default: validateMobile } }, @@ -84,7 +88,7 @@ export default create({ case 'name': return value ? value.length <= 15 ? '' : this.$t('nameOverlimit') : this.$t('nameEmpty'); case 'tel': - return validateMobile(value) ? '' : this.$t('telInvalid'); + return this.telValidator(value) ? '' : this.$t('telInvalid'); } }, From b3fe1a0953f89fb9dfbae82d12144bf6b418470c Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 8 Mar 2018 21:26:10 +0800 Subject: [PATCH 40/41] [bugfix] CouponList text max-width (#675) --- packages/vant-css/src/coupon-list.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/vant-css/src/coupon-list.css b/packages/vant-css/src/coupon-list.css index 7ac5d0a65..dc5372371 100644 --- a/packages/vant-css/src/coupon-list.css +++ b/packages/vant-css/src/coupon-list.css @@ -139,7 +139,7 @@ display: flex; margin-left: -1px; /* hack for flex space */ text-align: center; - padding-right: 16px; + margin-left: -16px; flex-direction: column; justify-content: center; background-image: linear-gradient(45deg, #ff6868, #ff8c8c); @@ -158,7 +158,6 @@ margin: 0; font-size: 14px; font-weight: 300; - max-width: 90px; @mixin ellipsis; } } From c43fbc8185b49c50eb67ae8e894475d64ad14055 Mon Sep 17 00:00:00 2001 From: wny Date: Fri, 9 Mar 2018 11:47:56 +0800 Subject: [PATCH 41/41] add close-on-click-overlay config for sku popup (#676) --- docs/demos/views/sku.vue | 2 ++ docs/markdown/en-US/sku.md | 2 ++ docs/markdown/zh-CN/sku.md | 2 ++ packages/sku/Sku.vue | 2 ++ 4 files changed, 8 insertions(+) diff --git a/docs/demos/views/sku.vue b/docs/demos/views/sku.vue index c3c72d586..34436aa82 100644 --- a/docs/demos/views/sku.vue +++ b/docs/demos/views/sku.vue @@ -13,6 +13,7 @@ reset-stepper-on-hide reset-selected-sku-on-hide disable-stepper-input + :close-on-click-overlay="closeOnClickOverlay" :message-config="messageConfig" @buy-clicked="onBuyClicked" @add-cart="onAddCartClicked" @@ -96,6 +97,7 @@ export default { showBase: false, showCustom: false, showStepper: false, + closeOnClickOverlay: true, initialSku: { s1: '30349', s2: '1193' diff --git a/docs/markdown/en-US/sku.md b/docs/markdown/en-US/sku.md index 9a9627daf..b3b8c27bd 100644 --- a/docs/markdown/en-US/sku.md +++ b/docs/markdown/en-US/sku.md @@ -21,6 +21,7 @@ Vue.use(Sku); :quota-used="quotaUsed" :reset-stepper-on-hide="resetStepperOnHide" :reset-selected-sku-on-hide="resetSelectedSkuOnHide" + :close-on-click-overlay="closeOnClickOverlay" :disable-stepper-input="disableStepperInput" :message-config="messageConfig" @buy-clicked="onBuyClicked" @@ -89,6 +90,7 @@ Vue.use(Sku); | reset-stepper-on-hide | Whether to reset stepper when hide | `Boolean` | `false` | - | | reset-selected-sku-on-hide | Whether to reset selected sku when hide | `Boolean` | `false` | - | | disable-stepper-input | Whether to disable stepper input | `Boolean` | `false` | - | +| close-on-click-overlay | Whether to close sku popup when click overlay | `Boolean` | `false` | - | | stepper-title | Quantity title | `String` | `Quantity` | - | | custom-stepper-config | Custom stepper related config | `Object` | `{}` | - | | message-config | Message related config | `Object` | `{}` | - | diff --git a/docs/markdown/zh-CN/sku.md b/docs/markdown/zh-CN/sku.md index 59492ee61..760013ea4 100644 --- a/docs/markdown/zh-CN/sku.md +++ b/docs/markdown/zh-CN/sku.md @@ -21,6 +21,7 @@ Vue.use(Sku); :quota-used="quotaUsed" :reset-stepper-on-hide="resetStepperOnHide" :reset-selected-sku-on-hide="resetSelectedSkuOnHide" + :close-on-click-overlay="closeOnClickOverlay" :disable-stepper-input="disableStepperInput" :message-config="messageConfig" @buy-clicked="onBuyClicked" @@ -90,6 +91,7 @@ Vue.use(Sku); | reset-stepper-on-hide | 窗口隐藏时重置选择的商品数量 | `Boolean` | `false` | - | | reset-selected-sku-on-hide | 窗口隐藏时重置已选择的sku | `Boolean` | `false` | - | | disable-stepper-input | 是否禁用sku中stepper的input框 | `Boolean` | `false` | - | +| close-on-click-overlay | 点击popup的overlay后是否关闭弹窗 | `Boolean` | `false` | - | | stepper-title | 数量选择组件左侧文案 | `String` | `购买数量` | - | | custom-stepper-config | 步进器相关自定义配置 | `Object` | `{}` | - | | message-config | 留言相关配置 | `Object` | `{}` | - | diff --git a/packages/sku/Sku.vue b/packages/sku/Sku.vue index 807ebfe77..e552f54db 100644 --- a/packages/sku/Sku.vue +++ b/packages/sku/Sku.vue @@ -5,6 +5,7 @@ position="bottom" lock-on-scroll prevent-scroll + :close-on-click-overlay="closeOnClickOverlay" :get-container="getContainer" >
@@ -145,6 +146,7 @@ export default create({ resetStepperOnHide: Boolean, resetSelectedSkuOnHide: Boolean, disableStepperInput: Boolean, + closeOnClickOverlay: Boolean, initialSku: { type: Object, default: () => ({})