From df34a0e85f13425b9b57e8b6b59f1daabaf4a690 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2020 09:41:34 +0800 Subject: [PATCH 1/8] build(deps): bump http-proxy from 1.18.0 to 1.18.1 in /packages/vant-cli (#7153) Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.18.0 to 1.18.1. - [Release notes](https://github.com/http-party/node-http-proxy/releases) - [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md) - [Commits](https://github.com/http-party/node-http-proxy/compare/1.18.0...1.18.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/vant-cli/yarn.lock | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/vant-cli/yarn.lock b/packages/vant-cli/yarn.lock index 9410de6e3..1de57919e 100644 --- a/packages/vant-cli/yarn.lock +++ b/packages/vant-cli/yarn.lock @@ -4161,7 +4161,7 @@ debug@4, debug@4.1.1, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: dependencies: ms "^2.1.1" -debug@^3.0.0, debug@^3.1.1, debug@^3.2.5: +debug@^3.1.1, debug@^3.2.5: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -4884,9 +4884,9 @@ etag@~1.8.1: integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= eventemitter3@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" - integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== events@^3.0.0: version "3.1.0" @@ -5347,11 +5347,9 @@ flush-write-stream@^1.0.0: readable-stream "^2.3.6" follow-redirects@^1.0.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.10.0.tgz#01f5263aee921c6a54fb91667f08f4155ce169eb" - integrity sha512-4eyLK6s6lH32nOvLLwlIOnr9zrL8Sm+OvW4pVTJNoXeGzYIkHVf+pADQi+OJ0E67hiuSLezPVPyBcIZO50TmmQ== - dependencies: - debug "^3.0.0" + version "1.13.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db" + integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA== for-in@^1.0.2: version "1.0.2" @@ -6059,9 +6057,9 @@ http-proxy-middleware@0.19.1: micromatch "^3.1.10" http-proxy@^1.17.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a" - integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ== + version "1.18.1" + resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" + integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== dependencies: eventemitter3 "^4.0.0" follow-redirects "^1.0.0" From 3f4a227fd789dd18c5597a8e72e8c222186103e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2020 14:46:52 +0800 Subject: [PATCH 2/8] build(deps): bump node-fetch from 2.6.0 to 2.6.1 in /packages/vant-icons (#7154) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/vant-icons/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vant-icons/yarn.lock b/packages/vant-icons/yarn.lock index d4c1007ec..97dba8e9f 100644 --- a/packages/vant-icons/yarn.lock +++ b/packages/vant-icons/yarn.lock @@ -3266,9 +3266,9 @@ nice-try@^1.0.4: integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-fetch@^2.3.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== node-gyp@^4.0.0: version "4.0.0" From ce881247027a6b776237174136e0a2b217df841d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2020 14:47:01 +0800 Subject: [PATCH 3/8] build(deps): bump node-fetch in /packages/create-vant-cli-app (#7155) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/create-vant-cli-app/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/create-vant-cli-app/yarn.lock b/packages/create-vant-cli-app/yarn.lock index c7bfcc3f4..6b8ceb112 100644 --- a/packages/create-vant-cli-app/yarn.lock +++ b/packages/create-vant-cli-app/yarn.lock @@ -2266,9 +2266,9 @@ nice-try@^1.0.4: integrity sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y= node-fetch@^2.3.0: - version "2.6.0" - resolved "https://registry.npm.taobao.org/node-fetch/download/node-fetch-2.6.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha1-5jNFY4bUqlWGP2dqerDaqP3ssP0= + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== normalize-package-data@^2.5.0: version "2.5.0" From 334d5da840e857d544d3171949176d218cc4ca8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2020 23:09:47 +0800 Subject: [PATCH 4/8] build(deps): bump node-fetch from 2.6.0 to 2.6.1 (#7165) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index fa6e2f4d6..b6d047c14 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8436,9 +8436,9 @@ no-case@^3.0.3: tslib "^1.10.0" node-fetch@^2.2.0, node-fetch@^2.3.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== node-forge@0.9.0: version "0.9.0" From 61106313dcf554c7936312c19eb2b36e34939f9e Mon Sep 17 00:00:00 2001 From: Callum <callum@netzstrategen.com> Date: Fri, 11 Sep 2020 17:11:14 +0200 Subject: [PATCH 5/8] feat(TabbarItem): add @tabbar-item-active-background-color less var (#7162) * Update var.less * Update index.less --- src/style/var.less | 1 + src/tabbar-item/index.less | 1 + 2 files changed, 2 insertions(+) diff --git a/src/style/var.less b/src/style/var.less index 70c28068c..08e075ce5 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -754,6 +754,7 @@ @tabbar-item-font-size: @font-size-sm; @tabbar-item-text-color: @gray-7; @tabbar-item-active-color: @blue; +@tabbar-item-active-background-color: @tabbar-background-color; @tabbar-item-line-height: 1; @tabbar-item-icon-size: 22px; @tabbar-item-margin-bottom: 4px; diff --git a/src/tabbar-item/index.less b/src/tabbar-item/index.less index da63a2fc3..3a3cbc6b9 100644 --- a/src/tabbar-item/index.less +++ b/src/tabbar-item/index.less @@ -28,6 +28,7 @@ } &--active { + background-color: @tabbar-item-active-background-color; color: @tabbar-item-active-color; } From 60ce34d4a75e59f45692030153f31995dcfc0837 Mon Sep 17 00:00:00 2001 From: neverland <chenjiahan@youzan.com> Date: Sat, 12 Sep 2020 08:28:47 +0800 Subject: [PATCH 6/8] fix(NoticeBar): fix cache issues with forwards and back history in safari (#7167) --- src/notice-bar/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/notice-bar/index.js b/src/notice-bar/index.js index 83db62c64..7c2784ff7 100644 --- a/src/notice-bar/index.js +++ b/src/notice-bar/index.js @@ -1,10 +1,19 @@ import { createNamespace, isDef } from '../utils'; import { doubleRaf } from '../utils/dom/raf'; +import { BindEventMixin } from '../mixins/bind-event'; import Icon from '../icon'; const [createComponent, bem] = createNamespace('notice-bar'); export default createComponent({ + mixins: [ + BindEventMixin(function (bind) { + // fix cache issues with forwards and back history in safari + // see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/ + bind(window, 'pageshow', this.start); + }), + ], + props: { text: String, mode: String, @@ -83,7 +92,8 @@ export default createComponent({ this.reset(); - setTimeout(() => { + clearTimeout(this.startTimer); + this.startTimer = setTimeout(() => { const { wrap, content } = this.$refs; if (!wrap || !content || this.scrollable === false) { return; From 9750984d784d16116bd5f4e8b0cd7a3562813219 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Sep 2020 20:44:32 +0800 Subject: [PATCH 7/8] build(deps): bump node-fetch from 2.6.0 to 2.6.1 in /packages/vant-cli (#7173) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/vant-cli/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vant-cli/yarn.lock b/packages/vant-cli/yarn.lock index 1de57919e..fb73e23e0 100644 --- a/packages/vant-cli/yarn.lock +++ b/packages/vant-cli/yarn.lock @@ -8290,9 +8290,9 @@ no-case@^3.0.3: tslib "^1.10.0" node-fetch@^2.2.0, node-fetch@^2.3.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== node-forge@0.9.0: version "0.9.0" From 2c38469591ddc05d5cd356a688e628a141dc0ed6 Mon Sep 17 00:00:00 2001 From: neverland <chenjiahan@youzan.com> Date: Sat, 12 Sep 2020 20:53:51 +0800 Subject: [PATCH 8/8] feat(Button): add icon-position prop (#7174) --- src/button/README.md | 1 + src/button/README.zh-CN.md | 3 +- src/button/index.less | 6 ++- src/button/index.tsx | 50 ++++++++++++------- .../test/__snapshots__/index.spec.js.snap | 7 +++ src/button/test/index.spec.js | 10 ++++ 6 files changed, 57 insertions(+), 20 deletions(-) diff --git a/src/button/README.md b/src/button/README.md index fbba897e5..9080768cb 100644 --- a/src/button/README.md +++ b/src/button/README.md @@ -111,6 +111,7 @@ Vue.use(Button); | color | Color, support linear-gradient | _string_ | - | | icon | Left Icon | _string_ | - | | icon-prefix `v2.6.0` | Icon className prefix | _string_ | `van-icon` | +| icon-position `v2.10.7` | Icon position, can be set to `right` | `left` | | tag | HTML Tag | _string_ | `button` | | native-type | Native Type Attribute | _string_ | `''` | | plain | Whether to be plain button | _boolean_ | `false` | diff --git a/src/button/README.zh-CN.md b/src/button/README.zh-CN.md index 66fe73a8e..672a87372 100644 --- a/src/button/README.zh-CN.md +++ b/src/button/README.zh-CN.md @@ -133,7 +133,8 @@ Vue.use(Button); | color | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - | | icon | 左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - | | icon-prefix `v2.6.0` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` | -| tag | 根节点的 HTML 标签 | _string_ | `button` | +| icon-position `v2.10.7` | 图标展示位置,可选值为 `right` | `left` | +| tag | 按钮根节点的 HTML 标签 | _string_ | `button` | | native-type | 原生 button 标签的 type 属性 | _string_ | - | | block | 是否为块级元素 | _boolean_ | `false` | | plain | 是否为朴素按钮 | _boolean_ | `false` | diff --git a/src/button/index.less b/src/button/index.less index 5f2ad00ae..10cd8e797 100644 --- a/src/button/index.less +++ b/src/button/index.less @@ -160,8 +160,10 @@ } &__icon + &__text, - &__loading + &__text { - margin-left: 5px; + &__loading + &__text, + &__text + &__icon, + &__text + &__loading { + margin-left: @padding-base; } &--hairline { diff --git a/src/button/index.tsx b/src/button/index.tsx index 5cfd67ce8..dbcfc06ad 100644 --- a/src/button/index.tsx +++ b/src/button/index.tsx @@ -35,6 +35,7 @@ export type ButtonProps = RouteProps & { loadingSize: string; loadingType?: LoadingType; loadingText?: string; + iconPosition: 'left' | 'right'; }; export type ButtonEvents = { @@ -63,6 +64,7 @@ function Button( loading, hairline, loadingText, + iconPosition, } = props; const style: Record<string, string | number> = {}; @@ -111,27 +113,33 @@ function Button( { [BORDER_SURROUND]: hairline }, ]; - function Content() { - const content = []; - + function renderIcon() { if (loading) { - content.push( - slots.loading ? ( - slots.loading() - ) : ( - <Loading - class={bem('loading')} - size={props.loadingSize} - type={props.loadingType} - color="currentColor" - /> - ) + return slots.loading ? ( + slots.loading() + ) : ( + <Loading + class={bem('loading')} + size={props.loadingSize} + type={props.loadingType} + color="currentColor" + /> ); - } else if (icon) { - content.push( + } + + if (icon) { + return ( <Icon name={icon} class={bem('icon')} classPrefix={props.iconPrefix} /> ); } + } + + function renderContent() { + const content = []; + + if (iconPosition === 'left') { + content.push(renderIcon()); + } let text; if (loading) { @@ -144,6 +152,10 @@ function Button( content.push(<span class={bem('text')}>{text}</span>); } + if (iconPosition === 'right') { + content.push(renderIcon()); + } + return content; } @@ -157,7 +169,7 @@ function Button( onTouchstart={onTouchstart} {...inherit(ctx)} > - <div class={bem('content')}>{Content()}</div> + <div class={bem('content')}>{renderContent()}</div> </tag> ); } @@ -194,6 +206,10 @@ Button.props = { type: String, default: '20px', }, + iconPosition: { + type: String, + default: 'left', + }, }; export default createComponent<ButtonProps, ButtonEvents, ButttonSlots>(Button); diff --git a/src/button/test/__snapshots__/index.spec.js.snap b/src/button/test/__snapshots__/index.spec.js.snap index 6c8c5a8eb..09bd1be32 100644 --- a/src/button/test/__snapshots__/index.spec.js.snap +++ b/src/button/test/__snapshots__/index.spec.js.snap @@ -1,5 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`icon-position prop 1`] = ` +<button class="van-button van-button--default van-button--normal"> + <div class="van-button__content"><i class="van-icon van-icon-plus van-button__icon"> + <!----></i></div> +</button> +`; + exports[`icon-prefix prop 1`] = ` <button class="van-button van-button--default van-button--normal"> <div class="van-button__content"><i class="my-icon my-icon-success van-button__icon"> diff --git a/src/button/test/index.spec.js b/src/button/test/index.spec.js index 8c9f2a179..bcb42939a 100644 --- a/src/button/test/index.spec.js +++ b/src/button/test/index.spec.js @@ -11,6 +11,16 @@ test('loading-size prop', () => { expect(wrapper).toMatchSnapshot(); }); +test('icon-position prop', () => { + const wrapper = mount(Button, { + propsData: { + icon: 'plus', + iconPosition: 'right', + }, + }); + expect(wrapper).toMatchSnapshot(); +}); + test('click event', () => { const onClick = jest.fn(); const wrapper = mount(Button, {