From 7a3fef0a0973e7dee72aec6a14f931fedd0e36b9 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 2 Nov 2017 05:00:29 -0500 Subject: [PATCH] [bugfix] Dialog should reset button text when showed (#278) * [bugfix] CouponList always show empty info * [bugfix] add click feedback of buttons in components * [Doc] add custom theme document * [new feature] Notice bar support more props * [bugfix] PullRefresh test cases * [bugfix] unused NoticeBar style * [bugfix] Swipe width calc error * [Doc] english document of all action components * [Doc] change document site path to /zanui/vant * [Doc] fix * [bugfix] uploader style error * [bugfix] tabs document demo * [new feature] Cell support vue-router target route * [bugfix] add cell test cases * update yarn.lock * [bugfix] Tabbar cann't display info when use icon slot * [Doc] update document title * [bugfix] Dialog should reset button text when showed * [new feature] CouponList add showCloseButton prop --- docs/examples-docs/zh-CN/coupon.md | 1 + packages/coupon-list/index.vue | 12 +++++++++++- packages/dialog/index.js | 2 ++ test/unit/specs/sku.spec.js | 8 ++++---- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/examples-docs/zh-CN/coupon.md b/docs/examples-docs/zh-CN/coupon.md index 261025cd5..92048fb57 100644 --- a/docs/examples-docs/zh-CN/coupon.md +++ b/docs/examples-docs/zh-CN/coupon.md @@ -157,6 +157,7 @@ export default { | exchangeButtonText | 兑换按钮文字 | `String` | `兑换` | - | | exchangeButtonDisabled | 是否禁用兑换按钮 | `Boolean` | `false` | - | | displayedCouponIndex | 滚动至特定优惠券位置 | `Number` | - | - | +| showCloseButton | 是否显示列表底部按钮 | `Boolean` | `true` | - | | closeButtonText | 列表底部按钮文字 | `String` | 不使用优惠 | - | | disabledListTitle | 不可用券列表标题 | `String` | 不可用优惠 | - | | inputPlaceholder | 输入框文字提示 | `String` | 请输入优惠码 | - | diff --git a/packages/coupon-list/index.vue b/packages/coupon-list/index.vue index 6b47715a6..7c5cb012c 100644 --- a/packages/coupon-list/index.vue +++ b/packages/coupon-list/index.vue @@ -25,7 +25,13 @@

暂无优惠券

-
{{ closeButtonText }}
+
+ {{ closeButtonText }} +
@@ -89,6 +95,10 @@ export default { showExchangeBar: { type: Boolean, default: true + }, + showCloseButton: { + type: Boolean, + default: true } }, diff --git a/packages/dialog/index.js b/packages/dialog/index.js index 13f96c899..08b98e651 100644 --- a/packages/dialog/index.js +++ b/packages/dialog/index.js @@ -7,6 +7,8 @@ const defaultConfig = { value: true, title: '', message: '', + confirmButtonText: '确认', + cancelButtonText: '取消', showCancelButton: false, closeOnClickOverlay: false, callback: action => { diff --git a/test/unit/specs/sku.spec.js b/test/unit/specs/sku.spec.js index 8701972b2..d4f64f323 100644 --- a/test/unit/specs/sku.spec.js +++ b/test/unit/specs/sku.spec.js @@ -90,7 +90,7 @@ describe('Sku', (done) => { // 未选择完整规格时,弹出toast提示 buyBtn.trigger('click'); wrapper.vm.$nextTick(() => { - const toastText = document.querySelector('.van-toast__text'); + const toastText = document.querySelector('.van-toast div'); expect(toastText.textContent).to.equal('请选择完整的规格'); expect(buyCallback.calledOnce).to.be.false; @@ -133,7 +133,7 @@ describe('Sku', (done) => { const minusBtn = wrapper.find('.van-stepper__minus')[0]; minusBtn.trigger('click'); wrapper.vm.$nextTick(() => { - const toastText = document.querySelector('.van-toast__text'); + const toastText = document.querySelector('.van-toast div'); expect(toastText.textContent).to.equal('至少选择一件'); // 手动修改购买数量 @@ -203,7 +203,7 @@ describe('Sku', (done) => { buyBtn.trigger('click'); wrapper.vm.$nextTick(() => { - const toastText = document.querySelector('.van-toast__text'); + const toastText = document.querySelector('.van-toast div'); expect(toastText.textContent).to.equal('请填写正确的身份证号码'); inputs[1].element.value = 330101198801012211; @@ -277,7 +277,7 @@ describe('Sku', (done) => { wrapper.vm.$nextTick(() => { buyBtn.trigger('click'); wrapper.vm.$nextTick(() => { - const toastText = document.querySelector('.van-toast__text'); + const toastText = document.querySelector('.van-toast div'); expect(toastText.textContent).to.equal('商品已经无法购买啦'); const plusBtn = wrapper.find('.van-stepper__plus')[0];