From 17472e04c576b8db1fcefbd329aa749f86bb86e1 Mon Sep 17 00:00:00 2001 From: Waiter Date: Thu, 28 Nov 2019 10:51:27 +0800 Subject: [PATCH 01/17] feat(Sku): add new startSaleNum prop (#5105) --- src/sku/README.md | 5 ++- src/sku/README.zh-CN.md | 5 ++- src/sku/Sku.js | 56 ++++++++++++++---------- src/sku/components/SkuStepper.js | 74 +++++++++++++++++++++++++++++--- src/sku/demo/data.js | 1 + src/sku/demo/index.vue | 10 +++-- src/sku/index.less | 15 ++++--- src/sku/lang.ts | 8 +++- 8 files changed, 132 insertions(+), 42 deletions(-) diff --git a/src/sku/README.md b/src/sku/README.md index 29ac44055..338ae6218 100644 --- a/src/sku/README.md +++ b/src/sku/README.md @@ -141,6 +141,7 @@ export default { | message-config | Message related config | *object* | `{}` | - | | get-container | Return the mount node for sku | *string \| () => Element* | - | - | | safe-area-inset-bottom | Whether to enable bottom safe area adaptation | *boolean* | `false` | 2.2.1 | +| start-sale-num | Minimum quantity | *number* | `1` | 2.2.15 | ### Events @@ -258,10 +259,10 @@ customStepperConfig: { quotaText: 'only 5 can buy', // custom callback when over limit handleOverLimit: (data) => { - const { action, limitType, quota, quotaUsed } = data; + const { action, limitType, quota, quotaUsed, startSaleNum } = data; if (action === 'minus') { - Toast('at least select one'); + Toast(`at least select ${startSaleNum > 1 ? startSaleNum : 'one'}`); } else if (action === 'plus') { // const { LIMIT_TYPE } = Sku.skuConstants; if (limitType === LIMIT_TYPE.QUOTA_LIMIT) { diff --git a/src/sku/README.zh-CN.md b/src/sku/README.zh-CN.md index 6b1c13a30..c1c23b0a8 100644 --- a/src/sku/README.zh-CN.md +++ b/src/sku/README.zh-CN.md @@ -145,6 +145,7 @@ export default { | initial-sku | 默认选中的 sku,具体参考高级用法 | *object* | `{}` | - | | show-soldout-sku | 是否展示售罄的 sku,默认展示并置灰 | *boolean* | `true` | - | | safe-area-inset-bottom | 是否开启底部安全区适配,[详细说明](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | *boolean* | `false` | 2.2.1 | +| start-sale-num | 起售数量 | *number* | `1` | 2.2.15 | ### Events @@ -270,10 +271,10 @@ customStepperConfig: { quotaText: '每次限购xxx件', // 自定义步进器超过限制时的回调 handleOverLimit: (data) => { - const { action, limitType, quota, quotaUsed } = data; + const { action, limitType, quota, quotaUsed, startSaleNum } = data; if (action === 'minus') { - Toast('至少选择一件商品'); + Toast(startSaleNum > 1 ? `${startSaleNum}件起售` : '至少选择一件商品'); } else if (action === 'plus') { // const { LIMIT_TYPE } = Sku.skuConstants; if (limitType === LIMIT_TYPE.QUOTA_LIMIT) { diff --git a/src/sku/Sku.js b/src/sku/Sku.js index de78d83cc..14bd49804 100644 --- a/src/sku/Sku.js +++ b/src/sku/Sku.js @@ -45,6 +45,10 @@ export default createComponent({ type: Number, default: 0 }, + startSaleNum: { + type: Number, + default: 1 + }, initialSku: { type: Object, default: () => ({}) @@ -236,22 +240,6 @@ export default createComponent({ ]; }, - quotaText() { - const { quotaText, hideQuotaText } = this.customStepperConfig; - - if (hideQuotaText) return ''; - - let text = ''; - - if (quotaText) { - text = quotaText; - } else if (this.quota > 0) { - text = t('quotaLimit', this.quota); - } - - return text; - }, - selectedText() { if (this.selectedSkuComb) { return `${t('selected')} ${this.selectedSkuValues.map(item => item.name).join(';')}`; @@ -274,6 +262,7 @@ export default createComponent({ skuEventBus.$on('sku:numChange', this.onNumChange); skuEventBus.$on('sku:previewImage', this.onPreviewImage); skuEventBus.$on('sku:overLimit', this.onOverLimit); + skuEventBus.$on('sku:stepperState', this.onStepperState); skuEventBus.$on('sku:addCart', this.onAddCart); skuEventBus.$on('sku:buy', this.onBuy); @@ -289,6 +278,8 @@ export default createComponent({ const { skuStepper } = this.$refs; const { selectedNum } = this.initialSku; const num = isDef(selectedNum) ? selectedNum : 1; + // 用来缓存不合法的情况 + this.stepperError = null; if (skuStepper) { skuStepper.setCurrentNum(num); @@ -409,18 +400,35 @@ export default createComponent({ } if (action === 'minus') { - Toast(t('minusTip')); + if (this.startSaleNum > 1) { + Toast(t('minusStartTip', this.startSaleNum)); + } else { + Toast(t('minusTip')); + } } else if (action === 'plus') { if (limitType === QUOTA_LIMIT) { - let msg = t('quotaLimit', quota); - if (quotaUsed > 0) msg += `,${t('quotaCount', quotaUsed)}`; - Toast(msg); + if (quotaUsed > 0) { + Toast(t('quotaUsedTip', quota, quotaUsed)); + } else { + Toast(t('quotaTip', quota)); + } } else { Toast(t('soldout')); } } }, + onStepperState(data) { + if (data.valid) { + this.stepperError = null; + } else { + this.stepperError = { + ...data, + action: 'plus', + }; + } + }, + onAddCart() { this.onBuyOrAddCart('add-cart'); }, @@ -430,6 +438,10 @@ export default createComponent({ }, onBuyOrAddCart(type) { + // 有信息表示该sku根本不符合购买条件 + if (this.stepperError) { + return this.onOverLimit(this.stepperError); + } const error = this.validateSku(); if (error) { Toast(error); @@ -463,7 +475,6 @@ export default createComponent({ selectedSku, selectedNum, stepperTitle, - hideQuotaText, selectedSkuComb } = this; @@ -494,7 +505,6 @@ export default createComponent({ {!this.hideStock && ( {this.stockText} - {!hideQuotaText && this.quotaText && ({this.quotaText})} )} {this.hasSku && !this.hideSelectedText && ( @@ -530,6 +540,7 @@ export default createComponent({ stock={this.stock} quota={this.quota} quotaUsed={this.quotaUsed} + startSaleNum={this.startSaleNum} skuEventBus={skuEventBus} selectedNum={selectedNum} selectedSku={selectedSku} @@ -537,6 +548,7 @@ export default createComponent({ skuStockNum={sku.stock_num} disableStepperInput={this.disableStepperInput} customStepperConfig={this.customStepperConfig} + hideQuotaText={this.hideQuotaText} onChange={event => { this.$emit('stepper-change', event); }} diff --git a/src/sku/components/SkuStepper.js b/src/sku/components/SkuStepper.js index 28eca7c38..dcaa9de55 100644 --- a/src/sku/components/SkuStepper.js +++ b/src/sku/components/SkuStepper.js @@ -16,6 +16,7 @@ export default createComponent({ stepperTitle: String, disableStepperInput: Boolean, customStepperConfig: Object, + hideQuotaText: Boolean, quota: { type: Number, default: 0 @@ -23,7 +24,11 @@ export default createComponent({ quotaUsed: { type: Number, default: 0 - } + }, + startSaleNum: { + type: Number, + default: 1, + }, }, data() { @@ -40,9 +45,17 @@ export default createComponent({ }, stepperLimit(limit) { - if (limit < this.currentNum) { + if (limit < this.currentNum && this.stepperMinLimit <= limit) { this.currentNum = limit; } + this.checkState(this.stepperMinLimit, limit); + }, + + stepperMinLimit(start) { + if (start > this.currentNum || start > this.stepperLimit) { + this.currentNum = start; + } + this.checkState(start, this.stepperLimit); } }, @@ -62,7 +75,35 @@ export default createComponent({ } return limit; - } + }, + stepperMinLimit() { + return this.startSaleNum < 1 ? 1 : this.startSaleNum; + }, + quotaText() { + const { quotaText, hideQuotaText } = this.customStepperConfig; + if (hideQuotaText) return ''; + + let text = ''; + + if (quotaText) { + text = quotaText; + } else { + const textArr = []; + if (this.startSaleNum > 1) { + textArr.push(t('quotaStart', this.startSaleNum)); + } + if (this.quota > 0) { + textArr.push(t('quotaLimit', this.quota)); + } + text = textArr.join(t('comma')); + } + + return text; + }, + }, + + created() { + this.checkState(this.stepperMinLimit, this.stepperLimit); }, methods: { @@ -75,7 +116,8 @@ export default createComponent({ action, limitType: this.limitType, quota: this.quota, - quotaUsed: this.quotaUsed + quotaUsed: this.quotaUsed, + startSaleNum: this.startSaleNum, }); }, @@ -83,7 +125,27 @@ export default createComponent({ const { handleStepperChange } = this.customStepperConfig; handleStepperChange && handleStepperChange(currentValue); this.$emit('change', currentValue); - } + }, + + checkState(min, max) { + // 如果选择小于起售,则强制变为起售 + if (this.currentNum < min || min > max) { + this.currentNum = min; + } else if (this.currentNum > max) { + // 当前选择数量大于最大可选时,需要重置已选数量 + this.currentNum = max; + } + + this.skuEventBus.$emit('sku:stepperState', { + valid: min <= max, + min, + max, + limitType: this.limitType, + quota: this.quota, + quotaUsed: this.quotaUsed, + startSaleNum: this.startSaleNum, + }); + }, }, render() { @@ -94,11 +156,13 @@ export default createComponent({ + {!this.hideQuotaText && this.quotaText && ({this.quotaText})} ); diff --git a/src/sku/demo/data.js b/src/sku/demo/data.js index 37df50828..c7674f10b 100644 --- a/src/sku/demo/data.js +++ b/src/sku/demo/data.js @@ -2,6 +2,7 @@ export default { goods_id: '946755', quota: 15, quota_used: 0, + start_sale_num: 10, goods_info: { title: '测试商品', picture: diff --git a/src/sku/demo/index.vue b/src/sku/demo/index.vue index 7e91966d1..b64802f40 100644 --- a/src/sku/demo/index.vue +++ b/src/sku/demo/index.vue @@ -11,6 +11,7 @@ :hide-stock="skuData.sku.hide_stock" :quota="skuData.quota" :quota-used="skuData.quota_used" + :start-sale-num="skuData.start_sale_num" :close-on-click-overlay="closeOnClickOverlay" :message-config="messageConfig" :custom-sku-validator="customSkuValidator" @@ -42,6 +43,7 @@ :hide-stock="skuData.sku.hide_stock" :quota="skuData.quota" :quota-used="skuData.quota_used" + :start-sale-num="skuData.start_sale_num" :custom-stepper-config="customStepperConfig" :message-config="messageConfig" hide-quota-text @@ -70,6 +72,7 @@ :hide-stock="skuData.sku.hide_stock" :quota="skuData.quota" :quota-used="skuData.quota_used" + :start-sale-num="skuData.start_sale_num" :custom-stepper-config="customStepperConfig" :message-config="messageConfig" :show-soldout-sku="false" @@ -99,6 +102,7 @@ :hide-stock="skuData.sku.hide_stock" :quota="skuData.quota" :quota-used="skuData.quota_used" + :start-sale-num="skuData.start_sale_num" show-add-cart-btn reset-stepper-on-hide safe-area-inset-bottom @@ -126,7 +130,7 @@ square size="large" type="danger" - @click="props.skuEventBus.$emit('sku:buy')" + @click="skuEventBus.$emit('sku:buy')" > {{ $t('button2') }} @@ -185,10 +189,10 @@ export default { quotaText: '单次限购100件', stockFormatter: (stock) => `剩余${stock}件`, handleOverLimit: (data) => { - const { action, limitType, quota } = data; + const { action, limitType, quota, startSaleNum = 1 } = data; if (action === 'minus') { - this.$toast('至少选择一件商品'); + this.$toast(startSaleNum > 1 ? `${startSaleNum}件起售` : '至少选择一件商品'); } else if (action === 'plus') { if (limitType === LIMIT_TYPE.QUOTA_LIMIT) { this.$toast(`限购${quota}件`); diff --git a/src/sku/index.less b/src/sku/index.less index 3ea21726d..beb8b2318 100644 --- a/src/sku/index.less +++ b/src/sku/index.less @@ -198,6 +198,7 @@ &-container { height: 30px; margin-right: 20px; + overflow: hidden; } } @@ -208,6 +209,14 @@ float: left; line-height: 30px; } + + &-quota { + display: inline-block; + float: right; + color: @red; + font-size: @font-size-sm; + line-height: 30px; + } } &__stock { @@ -221,12 +230,6 @@ } } - &__quota { - display: inline-block; - color: @red; - font-size: @font-size-sm; - } - &-messages { padding-bottom: @padding-xl; diff --git a/src/sku/lang.ts b/src/sku/lang.ts index 216c1dd06..90b5c1c1a 100644 --- a/src/sku/lang.ts +++ b/src/sku/lang.ts @@ -11,11 +11,12 @@ export default { soldout: '库存不足', originPrice: '原价', minusTip: '至少选择一件', + minusStartTip: (start: number) => `${start}件起售`, unavailable: '商品已经无法购买啦', stock: '剩余', stockUnit: '件', - quotaLimit: (quota: number) => `每人限购${quota}件`, - quotaCount: (count: number) => `你已购买${count}件` + quotaTip: (quota: number) => `每人限购${quota}件`, + quotaUsedTip: (quota: number, count: number) => `每人限购${quota}件,你已购买${count}件` }, vanSkuActions: { buy: '立即购买', @@ -26,6 +27,9 @@ export default { fail: '上传失败
重新上传' }, vanSkuStepper: { + quotaLimit: (quota: number) => `限购${quota}件`, + quotaStart: (start: number) => `${start}件起售`, + comma: ',', num: '购买数量' }, vanSkuMessages: { From cff400472179985fee2d934ec401a072a6c8669a Mon Sep 17 00:00:00 2001 From: Waiter Date: Thu, 28 Nov 2019 11:53:09 +0800 Subject: [PATCH 02/17] fix(Sku): change quota text style (#5133) --- src/sku/index.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sku/index.less b/src/sku/index.less index beb8b2318..21dd53483 100644 --- a/src/sku/index.less +++ b/src/sku/index.less @@ -196,7 +196,7 @@ } &-container { - height: 30px; + min-height: 30px; margin-right: 20px; overflow: hidden; } @@ -204,6 +204,7 @@ &__stepper { float: right; + padding-left: @padding-base; &-title { float: left; From 0946dd7b49dd3d2ba5b0b4800772e6fe17167ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 28 Nov 2019 11:58:27 +0800 Subject: [PATCH 03/17] build: release 2.3.0-beta.0 --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3e5cac539..e192270cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "2.2.14", + "version": "2.3.0-beta.0", "description": "Mobile UI Components built on Vue", "main": "lib/index.js", "module": "es/index.js", diff --git a/src/index.ts b/src/index.ts index c4dc4f3b4..e16426c5d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -89,7 +89,7 @@ declare global { } } -const version = '2.2.14'; +const version = '2.3.0-beta.0'; const components = [ ActionSheet, AddressEdit, From f7dea4836c2c17d1ea86f3c17d7991fae71da9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 28 Nov 2019 16:05:47 +0800 Subject: [PATCH 04/17] fix(List): should not render loading when finished --- src/list/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/list/index.js b/src/list/index.js index a824d1f29..8cff4998c 100644 --- a/src/list/index.js +++ b/src/list/index.js @@ -112,7 +112,7 @@ export default createComponent({ }, genLoading() { - if (this.innerLoading) { + if (this.innerLoading && !this.finished) { return (
{this.slots('loading') || ( From 5975117ac5d35cb96301a6808b7fd07b21d52d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 28 Nov 2019 16:19:09 +0800 Subject: [PATCH 05/17] fix(List): sync loading state --- src/list/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/list/index.js b/src/list/index.js index 8cff4998c..425fdd27c 100644 --- a/src/list/index.js +++ b/src/list/index.js @@ -49,6 +49,10 @@ export default createComponent({ }; }, + updated() { + this.innerLoading = this.loading; + }, + mounted() { if (this.immediateCheck) { this.check(); @@ -56,11 +60,8 @@ export default createComponent({ }, watch: { - finished: 'check', - loading(val) { - this.innerLoading = val; - this.check(); - } + loading: 'check', + finished: 'check' }, methods: { From d665378fec73f3d7f6f1a2dc5e37dc065078d6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 28 Nov 2019 16:22:40 +0800 Subject: [PATCH 06/17] build: release 2.2.15 --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e192270cf..c19afbbce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "2.3.0-beta.0", + "version": "2.2.15", "description": "Mobile UI Components built on Vue", "main": "lib/index.js", "module": "es/index.js", diff --git a/src/index.ts b/src/index.ts index e16426c5d..c7538ddb9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -89,7 +89,7 @@ declare global { } } -const version = '2.3.0-beta.0'; +const version = '2.2.15'; const components = [ ActionSheet, AddressEdit, From 00f6b5274fd3d15c1bfb82b39476caac3ea44484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 28 Nov 2019 16:28:50 +0800 Subject: [PATCH 07/17] docs(changelog): 2.2.15 --- docs/markdown/changelog.en-US.md | 8 ++++++++ docs/markdown/changelog.zh-CN.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/docs/markdown/changelog.en-US.md b/docs/markdown/changelog.en-US.md index f88feb1b6..f18fbd9d9 100644 --- a/docs/markdown/changelog.en-US.md +++ b/docs/markdown/changelog.en-US.md @@ -1,5 +1,13 @@ # Changelog +### [v2.2.15](https://github.com/youzan/vant/tree/v2.2.15) +`2019-11-28` + +**Bug Fixes** + +- fix List incorrect list status in some cases + + ### [v2.2.14](https://github.com/youzan/vant/tree/v2.2.14) `2019-11-22` diff --git a/docs/markdown/changelog.zh-CN.md b/docs/markdown/changelog.zh-CN.md index 32e0be66e..739d227f7 100644 --- a/docs/markdown/changelog.zh-CN.md +++ b/docs/markdown/changelog.zh-CN.md @@ -10,6 +10,14 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。 - 次版本号:每隔一至二个月发布,包含新特性和较大的功能更新,向下兼容。 - 主版本号:发布时间不定,包含不兼容更新,预计下一个主版本会与 Vue 3.0 同期发布。 +### [v2.2.15](https://github.com/youzan/vant/tree/v2.2.15) +`2019-11-28` + +**Bug Fixes** + +- 修复 List 组件在部分情况下加载状态未重置的问题 + + ### [v2.2.14](https://github.com/youzan/vant/tree/v2.2.14) `2019-11-22` From a7ae694dbb900c6bef8d206fb3db5d3e61d011fd Mon Sep 17 00:00:00 2001 From: Lindy <33708359+Lindysen@users.noreply.github.com> Date: Thu, 28 Nov 2019 19:07:50 +0800 Subject: [PATCH 08/17] =?UTF-8?q?feat(SubmitBar):=20SubmitBar=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4=E5=8F=8A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=96=87=E6=A1=88=E5=AF=B9=E9=BD=90=E6=96=B9=E5=90=91?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=20(#5130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/style/var.less | 6 +++++- src/submit-bar/README.md | 1 + src/submit-bar/README.zh-CN.md | 3 ++- src/submit-bar/demo/index.vue | 2 +- src/submit-bar/index.less | 15 ++++++++++++--- src/submit-bar/index.tsx | 19 +++++++++++-------- .../test/__snapshots__/demo.spec.js.snap | 8 ++++---- .../test/__snapshots__/index.spec.js.snap | 18 +++++++++++++----- src/submit-bar/test/index.spec.js | 12 ++++++++++++ 9 files changed, 61 insertions(+), 23 deletions(-) diff --git a/src/style/var.less b/src/style/var.less index 94d63ba5f..c70e52527 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -596,7 +596,7 @@ @submit-bar-background-color: @white; @submit-bar-button-width: 110px; @submit-bar-price-color: @red; -@submit-bar-price-font-size: 18px; +@submit-bar-price-font-size: @font-size-md; @submit-bar-currency-font-size: @font-size-md; @submit-bar-text-color: @text-color; @submit-bar-text-font-size: @font-size-md; @@ -606,6 +606,10 @@ @submit-bar-tip-color: #f56723; @submit-bar-tip-background-color: #fff7cc; @submit-bar-tip-icon-size: 12px; +@submit-bar-button-height: 40px; +@submit-bar-padding: 0 @padding-md; +@submit-bar-price-integer-font-size: 20px; +@submit-bar-price-font-family: Avenir-Heavy PingFang SC, Helvetica Neue, Arial, sans-serif; // Swipe @swipe-indicator-size: 6px; diff --git a/src/submit-bar/README.md b/src/submit-bar/README.md index 677ac7eab..a4f5b18e2 100644 --- a/src/submit-bar/README.md +++ b/src/submit-bar/README.md @@ -75,6 +75,7 @@ Use slot to add custom contents. | price | Price | *number* | - | - | | label | Price left label | *string* | `Total:` | - | | suffix-label | Price right label | *string* | - | - | +| text-align | Price label text align can be set to `right` `left` | *string* | `right` | - | | button-text | Button text | *string* | - | - | | button-type | Button type | *string* | `danger` | - | | tip | Tip | *string* | - | - | diff --git a/src/submit-bar/README.zh-CN.md b/src/submit-bar/README.zh-CN.md index 173bb706e..1070deb35 100644 --- a/src/submit-bar/README.zh-CN.md +++ b/src/submit-bar/README.zh-CN.md @@ -75,6 +75,7 @@ Vue.use(SubmitBar); | price | 价格(单位分) | *number* | - | - | | label | 价格左侧文案 | *string* | `合计:` | - | | suffix-label | 价格右侧文案 | *string* | - | - | +| text-align | 价格文案对齐方向,可选值为 `right` `left` | *string* | `right` | - | | button-text | 按钮文字 | *string* | - | - | | button-type | 按钮类型 | *string* | `danger` | - | | tip | 提示文案 | *string* | - | - | @@ -82,7 +83,7 @@ Vue.use(SubmitBar); | disabled | 是否禁用按钮 | *boolean* | `false` | - | | loading | 是否显示加载中的按钮 | *boolean* | `false` | - | | currency | 货币符号 | *string* | `¥` | - | -| decimal-length | 价格小数点后位数 | *number* | `2` | - | +| decimal-length | 价格小数点后位数 | *number* | `2` | - | | safe-area-inset-bottom | 是否开启底部安全区适配,[详细说明](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | *boolean* | `false` | - | ### Events diff --git a/src/submit-bar/demo/index.vue b/src/submit-bar/demo/index.vue index 8e34112ad..e8886ea78 100644 --- a/src/submit-bar/demo/index.vue +++ b/src/submit-bar/demo/index.vue @@ -102,7 +102,7 @@ export default { } .van-checkbox { - margin-left: @padding-sm; + margin-right: @padding-sm; } } diff --git a/src/submit-bar/index.less b/src/submit-bar/index.less index 9ab448b41..37ad37834 100644 --- a/src/submit-bar/index.less +++ b/src/submit-bar/index.less @@ -32,6 +32,7 @@ align-items: center; justify-content: flex-end; height: @submit-bar-height; + padding: @submit-bar-padding; font-size: @submit-bar-text-font-size; } @@ -53,15 +54,23 @@ &__price { color: @submit-bar-price-color; - font-size: @submit-bar-price-font-size; + font-size: @font-size-sm; - &::first-letter { - font-size: @submit-bar-currency-font-size; + &--integer { + font-size: @submit-bar-price-integer-font-size; + font-family: @submit-bar-price-font-family; } } &__button { width: @submit-bar-button-width; + height: @submit-bar-button-height; + line-height: @submit-bar-button-height; + border: none; + + &--danger { + background: @goods-action-button-danger-color; + } } &--safe-area-inset-bottom { diff --git a/src/submit-bar/index.tsx b/src/submit-bar/index.tsx index 50ff0aa82..4a4380979 100644 --- a/src/submit-bar/index.tsx +++ b/src/submit-bar/index.tsx @@ -20,6 +20,7 @@ export type SubmitBarProps = { suffixLabel?: string; decimalLength: number; safeAreaInsetBottom?: boolean; + textAlign?: 'right' | 'left'; }; export type SubmitBarSlots = DefaultSlots & { @@ -39,12 +40,14 @@ function SubmitBar( function Text() { if (typeof price === 'number') { - const priceText = `${props.currency} ${(price / 100).toFixed(props.decimalLength)}`; - + const priceArr = (price / 100).toFixed(props.decimalLength).split('.'); return ( -
+
{props.label || t('label')} - {priceText} + + {props.currency} + {priceArr[0]}.{priceArr[1]} + {props.suffixLabel && ( {props.suffixLabel} )} @@ -76,9 +79,8 @@ function SubmitBar( {slots.default && slots.default()} {Text()} +
合计:¥30.50
@@ -14,14 +14,14 @@ exports[`renders demo correctly 1`] = `
你的收货地址不支持同城送, 我们已为你推荐快递
-
合计:¥ 30.50
+
合计:¥30.50
-
合计:¥ 30.50
@@ -39,7 +39,7 @@ exports[`renders demo correctly 1`] = `
全选
-
合计:¥ 30.50
+
合计:¥30.50
diff --git a/src/submit-bar/test/__snapshots__/index.spec.js.snap b/src/submit-bar/test/__snapshots__/index.spec.js.snap index 004dae279..113fba541 100644 --- a/src/submit-bar/test/__snapshots__/index.spec.js.snap +++ b/src/submit-bar/test/__snapshots__/index.spec.js.snap @@ -3,7 +3,7 @@ exports[`decimal-length prop 1`] = `
-
合计:¥ 1.1
+
合计:¥1.1
`; @@ -11,7 +11,7 @@ exports[`decimal-length prop 1`] = ` exports[`disable submit 1`] = `
-
合计:¥ 0.01
+
合计:¥0.01
`; @@ -19,18 +19,26 @@ exports[`disable submit 1`] = ` exports[`suffix-label prop 1`] = `
-
Label¥ 1.11Suffix Label
+
Label¥1.11Suffix Label
+
+
+`; + +exports[`text-align prop 1`] = ` +
+
+
合计:¥1.11
`; exports[`top slot 1`] = ` -
top
+
top
`; exports[`without price 1`] = `
-
+
`; diff --git a/src/submit-bar/test/index.spec.js b/src/submit-bar/test/index.spec.js index 12832b105..4c4ea3246 100644 --- a/src/submit-bar/test/index.spec.js +++ b/src/submit-bar/test/index.spec.js @@ -85,3 +85,15 @@ test('suffix-label prop', () => { expect(wrapper).toMatchSnapshot(); }); + +test('text-align prop', () => { + const wrapper = mount(SubmitBar, { + context: { + props: { + price: 111, + textAlign: 'left' + } + } + }); + expect(wrapper).toMatchSnapshot(); +}); From abbee1062b587e5d4360bad4f362a33e8e793398 Mon Sep 17 00:00:00 2001 From: Lindy <33708359+Lindysen@users.noreply.github.com> Date: Fri, 29 Nov 2019 14:29:42 +0800 Subject: [PATCH 09/17] =?UTF-8?q?feat(Card):=20Card=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4=E6=B7=BB=E5=8A=A0=20price?= =?UTF-8?q?=20=E4=B8=8A=E6=96=B9=E7=9A=84=E6=8F=92=E6=A7=BD=20(#5134)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/card/README.md | 3 +- src/card/README.zh-CN.md | 7 ++-- src/card/index.less | 7 ++++ src/card/index.tsx | 25 +++++++++--- src/card/test/__snapshots__/demo.spec.js.snap | 38 ++++++++++++------- .../test/__snapshots__/index.spec.js.snap | 23 ++++++++++- src/card/test/index.spec.js | 11 ++++++ src/style/var.less | 10 +++-- 8 files changed, 97 insertions(+), 27 deletions(-) diff --git a/src/card/README.md b/src/card/README.md index e21fafc42..7c5efc0de 100644 --- a/src/card/README.md +++ b/src/card/README.md @@ -45,7 +45,7 @@ Use slot to custom content. @@ -94,6 +94,7 @@ Use slot to custom content. | num | Custom num | | price | Custom price | | origin-price | Custom origin price | +| price-top | Custom price top | | bottom | Custom price bottom | | thumb | Custom thumb | | tag | Custom thumb tag | diff --git a/src/card/README.zh-CN.md b/src/card/README.zh-CN.md index 6cbf13df9..b87dd2529 100644 --- a/src/card/README.zh-CN.md +++ b/src/card/README.zh-CN.md @@ -17,7 +17,7 @@ Vue.use(Card); @@ -32,7 +32,7 @@ Vue.use(Card); num="2" tag="标签" price="2.00" - desc="描述信息" + desc="描述信息" title="商品标题" thumb="https://img.yzcdn.cn/vant/t-thirt.jpg" origin-price="10.00" @@ -47,7 +47,7 @@ Vue.use(Card); @@ -96,6 +96,7 @@ Vue.use(Card); | num | 自定义数量 | | price | 自定义价格 | | origin-price | 自定义商品原价 | +| price-top | 自定义价格上方区域 | | bottom | 自定义价格下方区域 | | thumb | 自定义图片 | | tag | 自定义图片角标 | diff --git a/src/card/index.less b/src/card/index.less index 590d1d520..6d05cc91b 100644 --- a/src/card/index.less +++ b/src/card/index.less @@ -29,6 +29,7 @@ display: flex; flex: 1; flex-direction: column; + justify-content: space-between; min-width: 0; /* hack for flex box ellipsis */ min-height: @card-thumb-size; @@ -62,6 +63,11 @@ display: inline-block; color: @card-price-color; font-weight: @font-weight-bold; + + &--integer { + font-size: @card-price-integer-font-size; + font-family: @card-price-font-family; + } } &__origin-price { @@ -74,6 +80,7 @@ &__num { float: right; + color: @card-num-color; } &__tag { diff --git a/src/card/index.tsx b/src/card/index.tsx index 17e981e0d..2dc3cc48e 100644 --- a/src/card/index.tsx +++ b/src/card/index.tsx @@ -32,6 +32,7 @@ export type CardSlots = DefaultSlots & { bottom?: ScopedSlot; footer?: ScopedSlot; 'origin-price'?: ScopedSlot; + 'price-top'?: ScopedSlot; }; export type CardEvents = { @@ -114,11 +115,22 @@ function Card( } } + function PriceContent() { + const priceArr = props.price!.toString().split('.'); + return ( +
+ {props.currency} + {priceArr[0]}. + {priceArr[1]} +
+ ); + } + function Price() { if (showPrice) { return (
- {slots.price ? slots.price() : `${props.currency} ${props.price}`} + {slots.price ? slots.price() : PriceContent()}
); } @@ -137,7 +149,7 @@ function Card( function Num() { if (showNum) { - return
{slots.num ? slots.num() : `x ${props.num}`}
; + return
{slots.num ? slots.num() : `x${props.num}`}
; } } @@ -152,11 +164,14 @@ function Card(
{Thumb()}
- {Title()} - {Desc()} - {slots.tags && slots.tags()} +
+ {Title()} + {Desc()} + {slots.tags && slots.tags()} +
{showBottom && (
+ {slots['price-top'] && slots['price-top']()} {Price()} {OriginPrice()} {Num()} diff --git a/src/card/test/__snapshots__/demo.spec.js.snap b/src/card/test/__snapshots__/demo.spec.js.snap index d4a044fcb..77352ba68 100644 --- a/src/card/test/__snapshots__/demo.spec.js.snap +++ b/src/card/test/__snapshots__/demo.spec.js.snap @@ -11,11 +11,15 @@ exports[`renders demo correctly 1`] = `
-
商品名称
-
描述信息
+
+
商品名称
+
描述信息
+
-
¥ 2.00
-
x 2
+
+
¥2.00
+
+
x2
@@ -31,12 +35,16 @@ exports[`renders demo correctly 1`] = `
标签
-
商品名称
-
描述信息
+
+
商品名称
+
描述信息
+
-
¥ 2.00
+
+
¥2.00
+
¥ 10.00
-
x 2
+
x2
@@ -51,16 +59,20 @@ exports[`renders demo correctly 1`] = `
-
商品名称
-
描述信息
-
+
+
商品名称
+
描述信息
+
标签 标签
+
-
¥ 2.00
-
x 2
+
+
¥2.00
+
+
x2
diff --git a/src/card/test/__snapshots__/index.spec.js.snap b/src/card/test/__snapshots__/index.spec.js.snap index d4de2d22d..04e9c3d58 100644 --- a/src/card/test/__snapshots__/index.spec.js.snap +++ b/src/card/test/__snapshots__/index.spec.js.snap @@ -4,6 +4,7 @@ exports[`render bottom slot 1`] = `
+
Custom Bottom
@@ -14,6 +15,7 @@ exports[`render origin-price slot 1`] = `
+
Custom Origin Price
@@ -26,6 +28,7 @@ exports[`render price & num slot 1`] = `
+
Custom Price
Custom Num
@@ -38,7 +41,9 @@ exports[`render price & num slot 1`] = ` exports[`render thumb & tag slot 1`] = ` `; @@ -46,7 +51,21 @@ exports[`render thumb & tag slot 1`] = ` exports[`render title & desc slot 1`] = `
-
Custom TitleCustom desc
+
+
Custom TitleCustom desc
+
`; + +exports[`render price & price-top slot 1`] = ` +
+
+
+
+
Custom Price-top
Custom Price
+
+
+
+
+`; \ No newline at end of file diff --git a/src/card/test/index.spec.js b/src/card/test/index.spec.js index fcef9663e..6f1ef2718 100644 --- a/src/card/test/index.spec.js +++ b/src/card/test/index.spec.js @@ -94,3 +94,14 @@ test('render title & desc slot', () => { expect(wrapper).toMatchSnapshot(); }); + +test('render price & price-top slot', () => { + const wrapper = mount(Card, { + scopedSlots: { + price: () => 'Custom Price', + 'price-top': () => 'Custom Price-top' + } + }); + + expect(wrapper).toMatchSnapshot(); +}); diff --git a/src/style/var.less b/src/style/var.less index c70e52527..a905490a6 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -42,6 +42,7 @@ @font-size-md: 14px; @font-size-lg: 16px; @font-weight-bold: 500; +@price-integer-font-family: Avenir-Heavy PingFang SC, Helvetica Neue, Arial, sans-serif; // Animation @animation-duration-base: .3s; @@ -141,9 +142,12 @@ @card-title-line-height: 16px; @card-desc-color: @gray-7; @card-desc-line-height: 20px; -@card-price-color: @red; -@card-origin-price-color: @gray-7; +@card-price-color: @gray-8; +@card-origin-price-color: @gray-6; +@card-num-color: @gray-6; @card-origin-price-font-size: @font-size-xs; +@card-price-integer-font-size: @font-size-lg; +@card-price-font-family: @price-integer-font-family; // Cell @cell-font-size: @font-size-md; @@ -609,7 +613,7 @@ @submit-bar-button-height: 40px; @submit-bar-padding: 0 @padding-md; @submit-bar-price-integer-font-size: 20px; -@submit-bar-price-font-family: Avenir-Heavy PingFang SC, Helvetica Neue, Arial, sans-serif; +@submit-bar-price-font-family: @price-integer-font-family; // Swipe @swipe-indicator-size: 6px; From 00eeaedf17b84a0a185e2cf37a303b36f7e5552e Mon Sep 17 00:00:00 2001 From: Lindy <33708359+Lindysen@users.noreply.github.com> Date: Fri, 29 Nov 2019 17:47:43 +0800 Subject: [PATCH 10/17] feat(Card): adjust style (#5146) --- src/card/index.less | 1 + src/style/var.less | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/card/index.less b/src/card/index.less index 6d05cc91b..86df44a08 100644 --- a/src/card/index.less +++ b/src/card/index.less @@ -22,6 +22,7 @@ width: @card-thumb-size; height: @card-thumb-size; margin-right: @padding-xs; + border-radius: @card-thumb-border-radius; } &__content { diff --git a/src/style/var.less b/src/style/var.less index a905490a6..816bdb8b4 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -53,6 +53,7 @@ @border-width-base: 1px; @border-radius-sm: 2px; @border-radius-md: 4px; +@border-radius-lg: 8px; @border-radius-max: 999px; // ActionSheet @@ -138,7 +139,8 @@ @card-font-size: @font-size-sm; @card-text-color: @text-color; @card-background-color: @background-color-light; -@card-thumb-size: 90px; +@card-thumb-size: 88px; +@card-thumb-border-radius: @border-radius-lg; @card-title-line-height: 16px; @card-desc-color: @gray-7; @card-desc-line-height: 20px; From 3c45cdb231487d92293a66d882247122c274b723 Mon Sep 17 00:00:00 2001 From: Lindy <33708359+Lindysen@users.noreply.github.com> Date: Fri, 29 Nov 2019 17:49:41 +0800 Subject: [PATCH 11/17] feat(SubmitBar): adjust style and unit test (#5151) --- src/submit-bar/index.less | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/submit-bar/index.less b/src/submit-bar/index.less index 37ad37834..f9818d144 100644 --- a/src/submit-bar/index.less +++ b/src/submit-bar/index.less @@ -40,7 +40,6 @@ flex: 1; padding-right: @padding-sm; color: @submit-bar-text-color; - font-weight: @font-weight-bold; text-align: right; span { @@ -50,10 +49,12 @@ &__suffix-label { margin-left: 5px; + font-weight: @font-weight-bold; } &__price { color: @submit-bar-price-color; + font-weight: @font-weight-bold; font-size: @font-size-sm; &--integer { @@ -65,6 +66,7 @@ &__button { width: @submit-bar-button-width; height: @submit-bar-button-height; + font-weight: @font-weight-bold; line-height: @submit-bar-button-height; border: none; From d1a8adab20e579deeb1a10e31e6a7c31f35c3a1f Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 30 Nov 2019 08:22:17 +0800 Subject: [PATCH 12/17] fix(TreeSelect): should sync value before trigger click-item event (#5153) --- src/tree-select/index.tsx | 6 ++---- src/tree-select/test/index.spec.js | 34 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/tree-select/index.tsx b/src/tree-select/index.tsx index 73dbde230..e0584b175 100644 --- a/src/tree-select/index.tsx +++ b/src/tree-select/index.tsx @@ -97,9 +97,8 @@ function TreeSelect( } } - emit(ctx, 'click-item', item); emit(ctx, 'update:active-id', newActiveId); - + emit(ctx, 'click-item', item); // compatible for old usage, should be removed in next major version emit(ctx, 'itemclick', item); } @@ -119,9 +118,8 @@ function TreeSelect( class={bem('nav')} activeKey={mainActiveIndex} onChange={(index: number) => { - emit(ctx, 'click-nav', index); emit(ctx, 'update:main-active-index', index); - + emit(ctx, 'click-nav', index); // compatible for old usage, should be removed in next major version emit(ctx, 'navclick', index); }} diff --git a/src/tree-select/test/index.spec.js b/src/tree-select/test/index.spec.js index 47b25fc7d..09eb0c3a7 100644 --- a/src/tree-select/test/index.spec.js +++ b/src/tree-select/test/index.spec.js @@ -295,3 +295,37 @@ test('className of nav', () => { const items = wrapper.findAll('.van-tree-select__nav-item'); expect(items.at(0).element.classList.contains('my-class')).toBeTruthy(); }); + +test('should sync value before trigger click-item event', done => { + const wrapper = mount({ + template: ` + + `, + data() { + return { + activeId: mockItem.id, + mainActiveIndex: 0, + items: [ + { + text: 'group1', + children: [mockItem, mockItem2] + } + ] + }; + }, + methods: { + onClickItem() { + expect(wrapper.vm.activeId).toEqual(mockItem2.id); + done(); + } + } + }); + + const items = wrapper.findAll('.van-tree-select__item'); + items.at(1).trigger('click'); +}); From 7f2e9b21c3260ccc590ed501a2694fb81fa04d57 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 30 Nov 2019 08:58:36 +0800 Subject: [PATCH 13/17] feat(CountDown): support SS and S format (#5154) --- src/count-down/README.md | 16 +++++++++++-- src/count-down/README.zh-CN.md | 16 +++++++++++-- src/count-down/demo/index.vue | 2 +- .../test/__snapshots__/index.spec.js.snap | 4 ++++ src/count-down/test/index.spec.js | 24 +++++++++++++++++++ src/count-down/utils.ts | 14 ++++++++++- 6 files changed, 70 insertions(+), 6 deletions(-) diff --git a/src/count-down/README.md b/src/count-down/README.md index 59bd61467..efac70b44 100644 --- a/src/count-down/README.md +++ b/src/count-down/README.md @@ -42,7 +42,7 @@ export default { ``` @@ -114,10 +114,22 @@ export default { | Attribute | Description | Type | Default | Version | |------|------|------|------|------| | time | Total time | *number* | - | - | -| format | Time format,DD-day,HH-hour,mm-minute,ss-second,SSS-millisecond | *string* | `HH:mm:ss` | - | +| format | Time format | *string* | `HH:mm:ss` | - | | auto-start | Whether to auto start count down | *boolean* | `true` | - | | millisecond | Whether to enable millisecond render | *boolean* | `false` | - | +### Available formats + +| Format | Description | +|------|------| +| DD | Day | +| HH | Hour | +| mm | Minute | +| ss | Second | +| S | Millisecond, 1-digit | +| SS | Millisecond, 2-digits | +| SSS | Millisecond, 3-digits | + ### Events | Event | Description | Arguments | diff --git a/src/count-down/README.zh-CN.md b/src/count-down/README.zh-CN.md index e5f6358da..31e4fec86 100644 --- a/src/count-down/README.zh-CN.md +++ b/src/count-down/README.zh-CN.md @@ -48,7 +48,7 @@ export default { ``` @@ -124,10 +124,22 @@ export default { | 参数 | 说明 | 类型 | 默认值 | 版本 | |------|------|------|------|------| | time | 倒计时时长,单位毫秒 | *number* | - | - | -| format | 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 | *string* | `HH:mm:ss` | - | +| format | 时间格式 | *string* | `HH:mm:ss` | - | | auto-start | 是否自动开始倒计时 | *boolean* | `true` | - | | millisecond | 是否开启毫秒级渲染 | *boolean* | `false` | - | +### format 格式 + +| 格式 | 说明 | +|------|------| +| DD | 天数 | +| HH | 小时 | +| mm | 分钟 | +| ss | 秒数 | +| S | 毫秒(1 位) | +| SS | 毫秒(2 位) | +| SSS | 毫秒(3 位) | + ### Events | 事件名 | 说明 | 回调参数 | diff --git a/src/count-down/demo/index.vue b/src/count-down/demo/index.vue index a1e6417fc..6c5c624fb 100644 --- a/src/count-down/demo/index.vue +++ b/src/count-down/demo/index.vue @@ -15,7 +15,7 @@ diff --git a/src/count-down/test/__snapshots__/index.spec.js.snap b/src/count-down/test/__snapshots__/index.spec.js.snap index 6a6dc9335..24d2499e0 100644 --- a/src/count-down/test/__snapshots__/index.spec.js.snap +++ b/src/count-down/test/__snapshots__/index.spec.js.snap @@ -5,3 +5,7 @@ exports[`complete format prop 1`] = `
01-05-59-59-999 exports[`disable auto-start prop 1`] = `
100
`; exports[`incomplate format prop 1`] = `
29-59-59-999
`; + +exports[`milliseconds format S 1`] = `
01-5
`; + +exports[`milliseconds format SS 1`] = `
01-50
`; diff --git a/src/count-down/test/index.spec.js b/src/count-down/test/index.spec.js index 0f014f086..2cdefe0da 100644 --- a/src/count-down/test/index.spec.js +++ b/src/count-down/test/index.spec.js @@ -141,6 +141,30 @@ test('complete format prop', () => { expect(wrapper).toMatchSnapshot(); }); +test('milliseconds format SS', () => { + const wrapper = mount(CountDown, { + propsData: { + time: 1500, + autoStart: false, + format: 'ss-SS' + } + }); + + expect(wrapper).toMatchSnapshot(); +}); + +test('milliseconds format S', () => { + const wrapper = mount(CountDown, { + propsData: { + time: 1500, + autoStart: false, + format: 'ss-S' + } + }); + + expect(wrapper).toMatchSnapshot(); +}); + test('incomplate format prop', () => { const wrapper = mount(CountDown, { propsData: { diff --git a/src/count-down/utils.ts b/src/count-down/utils.ts index bed42a80e..811f537da 100644 --- a/src/count-down/utils.ts +++ b/src/count-down/utils.ts @@ -57,7 +57,19 @@ export function parseFormat(format: string, timeData: TimeData): string { format = format.replace('ss', padZero(seconds)); } - return format.replace('SSS', padZero(milliseconds, 3)); + if (format.indexOf('S') !== -1) { + const ms = padZero(milliseconds, 3); + + if (format.indexOf('SSS') !== -1) { + format = format.replace('SSS', ms); + } else if (format.indexOf('SS') !== -1) { + format = format.replace('SS', ms.slice(0, 2)); + } else { + format = format.replace('S', ms.charAt(0)); + } + } + + return format; } export function isSameSecond(time1: number, time2: number): boolean { From 767b13f6ea49872bb65cb8094e10d31290061f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Sat, 30 Nov 2019 12:51:21 +0800 Subject: [PATCH 14/17] build: release 2.3.0-beta.1 --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c19afbbce..c1e69fabf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "2.2.15", + "version": "2.3.0-beta.1", "description": "Mobile UI Components built on Vue", "main": "lib/index.js", "module": "es/index.js", diff --git a/src/index.ts b/src/index.ts index c7538ddb9..9cba2e473 100644 --- a/src/index.ts +++ b/src/index.ts @@ -89,7 +89,7 @@ declare global { } } -const version = '2.2.15'; +const version = '2.3.0-beta.1'; const components = [ ActionSheet, AddressEdit, From 2915ea1868d005ba9c04670934fa2211e16f7a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Sun, 1 Dec 2019 13:17:50 +0800 Subject: [PATCH 15/17] docs(changelog): 2.3.0-beta.1 --- docs/markdown/changelog.en-US.md | 34 +++++++++++++++++++++++++++++++ docs/markdown/changelog.zh-CN.md | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/docs/markdown/changelog.en-US.md b/docs/markdown/changelog.en-US.md index f18fbd9d9..62c8d159f 100644 --- a/docs/markdown/changelog.en-US.md +++ b/docs/markdown/changelog.en-US.md @@ -1,5 +1,39 @@ # Changelog +### [v2.3.0-beta.1](https://github.com/youzan/vant/tree/v2.3.0-beta.1) +`2019-11-30` + +**Style** + +Upgrading the style of business components: + +- AddressEdit +- Card +- ContactList +- ContactCard +- ContactEdit +- SubmitBar + +**Features** + +- Card: add price-top slot [\#5134](https://github.com/youzan/vant/pull/5134) +- Circle: add stroke-linecap prop [\#5087](https://github.com/youzan/vant/pull/5087) +- CountDown: support SS and S format [\#5154](https://github.com/youzan/vant/pull/5154) +- Sku: add new startSaleNum prop [\#5105](https://github.com/youzan/vant/pull/5105) +- SubmitBar: add text-align prop [\#5130](https://github.com/youzan/vant/pull/5130) +- AddressList: add default-tag-text prop [\#5106](https://github.com/youzan/vant/pull/5106) +- ContactList: add default-tag-text prop [\#5089](https://github.com/youzan/vant/pull/5089) +- ContactCard: add show-set-default prop [\#5083](https://github.com/youzan/vant/pull/5083) +- Toast: improve type definitions [\#5086](https://github.com/youzan/vant/pull/5086) + +**Bug Fixes** + +- fix TreeSelect should sync value before trigger click-item event [\#5153](https://github.com/youzan/vant/pull/5153) +- fix TouchEmulator compatibility issues on firefox [\#5118](https://github.com/youzan/vant/pull/5118) +- fix Card allow use bottom slot without price or num [\#5116](https://github.com/youzan/vant/pull/5116) +- fix NumberKeyboard should not trigger blur event when hidden [\#5110](https://github.com/youzan/vant/pull/5110) + + ### [v2.2.15](https://github.com/youzan/vant/tree/v2.2.15) `2019-11-28` diff --git a/docs/markdown/changelog.zh-CN.md b/docs/markdown/changelog.zh-CN.md index 739d227f7..3203624a6 100644 --- a/docs/markdown/changelog.zh-CN.md +++ b/docs/markdown/changelog.zh-CN.md @@ -10,6 +10,41 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。 - 次版本号:每隔一至二个月发布,包含新特性和较大的功能更新,向下兼容。 - 主版本号:发布时间不定,包含不兼容更新,预计下一个主版本会与 Vue 3.0 同期发布。 + +### [v2.3.0-beta.1](https://github.com/youzan/vant/tree/v2.3.0-beta.1) +`2019-11-30` + +**Style** + +在 2.3.0 版本中,我们对业务组件的样式进行了全新升级,涉及以下组件: + +- AddressEdit +- Card +- ContactList +- ContactCard +- ContactEdit +- SubmitBar + +**Features** + +- Card: 新增 price-top 插槽 [\#5134](https://github.com/youzan/vant/pull/5134) +- Circle: 新增 stroke-linecap 属性 [\#5087](https://github.com/youzan/vant/pull/5087) +- CountDown: 支持 SS 和 S 格式 [\#5154](https://github.com/youzan/vant/pull/5154) +- Sku: 新增 new startSaleNum 属性 [\#5105](https://github.com/youzan/vant/pull/5105) +- SubmitBar: 新增 text-align 属性 [\#5130](https://github.com/youzan/vant/pull/5130) +- AddressList: 新增 default-tag-text 属性 [\#5106](https://github.com/youzan/vant/pull/5106) +- ContactList: 新增 default-tag-text 属性 [\#5089](https://github.com/youzan/vant/pull/5089) +- ContactCard: 新增 show-set-default 属性 [\#5083](https://github.com/youzan/vant/pull/5083) +- Toast: 完善 TS 类型定义 [\#5086](https://github.com/youzan/vant/pull/5086) + +**Bug Fixes** + +- 修复 TreeSelect 事件触发顺序错误的问题 [\#5153](https://github.com/youzan/vant/pull/5153) +- 修复 TouchEmulator 在 Firefox 上的兼容性问题 [\#5118](https://github.com/youzan/vant/pull/5118) +- 修复 Card 在未使用 price 属性的情况下 bottom 插槽不生效的问题 [\#5116](https://github.com/youzan/vant/pull/5116) +- 修复 NumberKeyboard 在隐藏状态下也会触发 blur 事件的问题 [\#5110](https://github.com/youzan/vant/pull/5110) + + ### [v2.2.15](https://github.com/youzan/vant/tree/v2.2.15) `2019-11-28` From f16635f5f1be306aac73f2cc2052d8747f262b1e Mon Sep 17 00:00:00 2001 From: OhNow <70829793@qq.com> Date: Sun, 1 Dec 2019 13:20:05 +0800 Subject: [PATCH 16/17] fix less import issue (#5157) --- src/style/var.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/style/var.less b/src/style/var.less index 816bdb8b4..445c19258 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -693,7 +693,7 @@ @toast-loading-icon-color: @white; @toast-line-height: 20px; @toast-border-radius: @border-radius-md; -@toast-background-color: rgba(@text-color, .88); +@toast-background-color: fade(@text-color, 88%); @toast-icon-size: 40px; @toast-text-min-width: 96px; @toast-text-padding: @padding-xs @padding-sm; From bcba1bcac51b8d443b53b19c8defa231e045f638 Mon Sep 17 00:00:00 2001 From: OhNow <70829793@qq.com> Date: Mon, 2 Dec 2019 10:33:07 +0800 Subject: [PATCH 17/17] fix spelling mistake (#5162) --- src/style/var.less | 2 +- src/tag/index.less | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/style/var.less b/src/style/var.less index 445c19258..1172ad8aa 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -679,7 +679,7 @@ @tag-text-color: @white; @tag-border-radius: .2em; @tag-round-border-radius: @border-radius-max; -@tag-dander-color: @red; +@tag-danger-color: @red; @tag-primary-color: @blue; @tag-success-color: @green; @tag-warning-color: @orange; diff --git a/src/tag/index.less b/src/tag/index.less index 88d6cfae7..f01fc6235 100644 --- a/src/tag/index.less +++ b/src/tag/index.less @@ -23,10 +23,10 @@ } &--danger { - background-color: @tag-dander-color; + background-color: @tag-danger-color; &.van-tag--plain { - color: @tag-dander-color; + color: @tag-danger-color; } }