From c221922e04575463a8e4ece566ebb70d4e52ed24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 8 Sep 2017 16:33:20 +0800 Subject: [PATCH 01/18] Loading: fix white spinner color --- docs/examples-docs/loading.md | 2 +- packages/vant-css/src/loading.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples-docs/loading.md b/docs/examples-docs/loading.md index b6a4521f7..4b577895c 100644 --- a/docs/examples-docs/loading.md +++ b/docs/examples-docs/loading.md @@ -22,8 +22,8 @@ Vue.component(Loading.name, Loading); :::demo 单色 spinner ```html - + ``` ::: diff --git a/packages/vant-css/src/loading.css b/packages/vant-css/src/loading.css index 94288eeb3..055031e79 100644 --- a/packages/vant-css/src/loading.css +++ b/packages/vant-css/src/loading.css @@ -41,8 +41,8 @@ } &.van-loading__spinner--white { - border-color: rgba(0, 0, 0, .5); - border-top-color: transparent; + border-color: rgba(0, 0, 0, .1); + border-top-color: rgba(255, 255, 255, .7); } } From f0cbcc99dcb5c78d72396c2c19565b1cc371d55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 8 Sep 2017 21:06:16 +0800 Subject: [PATCH 02/18] add NumberKeyboard component --- docs/examples-docs/number-keyboard.md | 101 ++++++++++++++ docs/src/doc.config.js | 4 + packages/index.js | 3 + packages/number-keyboard/index.vue | 137 +++++++++++++++++++ packages/vant-css/src/base.css | 1 + packages/vant-css/src/common/animation.css | 21 +++ packages/vant-css/src/index.css | 1 + packages/vant-css/src/number-keyboard.css | 52 ++++++++ test/unit/specs/number-keyboard.spec.js | 146 +++++++++++++++++++++ 9 files changed, 466 insertions(+) create mode 100644 docs/examples-docs/number-keyboard.md create mode 100644 packages/number-keyboard/index.vue create mode 100644 packages/vant-css/src/common/animation.css create mode 100644 packages/vant-css/src/number-keyboard.css create mode 100644 test/unit/specs/number-keyboard.spec.js diff --git a/docs/examples-docs/number-keyboard.md b/docs/examples-docs/number-keyboard.md new file mode 100644 index 000000000..362d1d1f8 --- /dev/null +++ b/docs/examples-docs/number-keyboard.md @@ -0,0 +1,101 @@ + + + + +## NumberKeyboard 数字键盘 + +### 使用指南 +``` javascript +import { NumberKeyboard } from 'vant'; + +Vue.component(NumberKeyboard.name, NumberKeyboard); +``` + +### 代码演示 + +#### 基础用法 + +:::demo 基础用法 +```html + + 弹出键盘 + + + + 收起键盘 + + + +``` + +```javascript +export default { + data() { + return { + showKeyboard: true + } + }, + + methods: { + onInput(value) { + Toast(value); + }, + onDelete() { + Toast('delete'); + } + } +} +``` +::: + + +### API + +| 参数 | 说明 | 类型 | 默认值 | 可选值 | +|-----------|-----------|-----------|-------------|-------------| +| show | 是否显示键盘 | `Boolean` | - | - | +| title | 键盘标题 | `String` | `安全输入键盘` | - | +| extraKey | 左下角按键内容 | `String` | `''` | - | +| zIndex | 键盘 z-index | `Number` | `100` | - | +| transition | 是否开启过场动画 | `Boolean` | `true` | - | +| showDeleteKey | 是否展示删除按钮 | `Boolean` | `true` | - | + +### Event + +| 事件名 | 说明 | 参数 | +|-----------|-----------|-----------| +| input | 点击按键时触发 | key: 按键内容 | +| delete | 点击删除键时触发 | - | +| blur | 点击非键盘区域时触发 | - | +| show | 键盘完全弹出时触发 | - | +| hide | 键盘完全收起时触发 | - | diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index 492844c19..a840d170d 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -143,6 +143,10 @@ module.exports = { "path": "/field", "title": "Field 输入框" }, + { + "path": "/number-keyboard", + "title": "NumberKeyboard 数字键盘" + }, { "path": "/radio", "title": "Radio 单选框" diff --git a/packages/index.js b/packages/index.js index 2129658e0..08d141822 100644 --- a/packages/index.js +++ b/packages/index.js @@ -24,6 +24,7 @@ import Lazyload from './lazyload'; import Loading from './loading'; import NavBar from './nav-bar'; import NoticeBar from './notice-bar'; +import NumberKeyboard from './number-keyboard'; import Panel from './panel'; import Picker from './picker'; import Popup from './popup'; @@ -74,6 +75,7 @@ const components = [ Loading, NavBar, NoticeBar, + NumberKeyboard, Panel, Picker, Popup, @@ -140,6 +142,7 @@ export { Loading, NavBar, NoticeBar, + NumberKeyboard, Panel, Picker, Popup, diff --git a/packages/number-keyboard/index.vue b/packages/number-keyboard/index.vue new file mode 100644 index 000000000..41ac7d1f1 --- /dev/null +++ b/packages/number-keyboard/index.vue @@ -0,0 +1,137 @@ + + + diff --git a/packages/vant-css/src/base.css b/packages/vant-css/src/base.css index 5cbf9bc24..9a148e573 100644 --- a/packages/vant-css/src/base.css +++ b/packages/vant-css/src/base.css @@ -5,4 +5,5 @@ @import "./common/var.css"; @import "./common/normalize.css"; @import "./common/hairline.css"; +@import "./common/animation.css"; diff --git a/packages/vant-css/src/common/animation.css b/packages/vant-css/src/common/animation.css new file mode 100644 index 000000000..070c8e1fc --- /dev/null +++ b/packages/vant-css/src/common/animation.css @@ -0,0 +1,21 @@ +@keyframes van-slide-bottom-enter { + from { + transform: translate3d(0, 100%, 0); + } +} + +@keyframes van-slide-bottom-leave { + to { + transform: translate3d(0, 100%, 0); + } +} + +.van-slide-bottom { + &-enter-active { + animation: van-slide-bottom-enter .3s both ease; + } + + &-leave-active { + animation: van-slide-bottom-leave .3s both ease; + } +} diff --git a/packages/vant-css/src/index.css b/packages/vant-css/src/index.css index 140c245e2..545716d92 100644 --- a/packages/vant-css/src/index.css +++ b/packages/vant-css/src/index.css @@ -34,6 +34,7 @@ @import './radio.css'; @import './switch.css'; @import './uploader.css'; +@import './number-keyboard.css'; /* action components */ @import './actionsheet.css'; diff --git a/packages/vant-css/src/number-keyboard.css b/packages/vant-css/src/number-keyboard.css new file mode 100644 index 000000000..fc2c4b39a --- /dev/null +++ b/packages/vant-css/src/number-keyboard.css @@ -0,0 +1,52 @@ +@import "./common/var.css"; + +.van-number-keyboard { + left: 0; + bottom: 0; + width: 100%; + position: fixed; + user-select: none; + background-color: $white; + animation-timing-function: ease-out; + + &__title { + font-weight: 400; + text-align: center; + color: $gray-dark; + font-size: 12px; + line-height: 25px; + } + + i { + width: calc(100%/3); + height: 54px; + font-size: 24px; + line-height: 54px; + font-style: normal; + text-align: center; + display: inline-block; + vertical-align: middle; + + &::after { + border-top-width: 1px; + } + + &:not(:nth-of-type(3n))::after { + border-right-width: 1px; + } + + &:nth-of-type(10), + &:nth-of-type(12) { + background-color: #F3F3F6; + } + } + + &__delete { + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAeCAMAAABg6AyVAAAAbFBMVEUAAAAfHiIdHB4eHR8dHR4eHB4dHB4dHR8gICIdHB4dHB4dHB4dHB8eHh8hISEeHR8fHB8fHR8fHR8fHx8eHiArKyszMzMeHB8eHB8fHR8eHiAeHh4dHB4vLjDY2Nn////b29zKysq9vb28vLzkfBRpAAAAHHRSTlMAK/PW+I/llBv77N1kSCPwWlFAOTMGBb28hHlu08g5sgAAAMlJREFUOMuV1MsWgiAQgGHQyOx+s+sgYO//jnnMGIdDDfwbN99CYEDQFiVEKkolPUG7gl9VTWC31NKuDbVz+Fc1tRJtPDmxS2BS3p5ZC+XXnnbAVoz2WEBCH7uZAalzGoa06whGiznT6sG2xgX4QO2Aej1+KN7XBKL2FvGaMtTWBhbQhtoaYzVQrHKwuGf8hhAPSF5g3xPSt45sCHcouNWx436FGA+RHyQcD35EcUj54U8ff4WYvVi1zLjelUh/OG6XjOeLWv5hfAOI+HLwwOAqhAAAAABJRU5ErkJggg==") no-repeat center center; + background-size: auto 15px; + } + + i&--active { + background-color: $active-color!important; + } +} diff --git a/test/unit/specs/number-keyboard.spec.js b/test/unit/specs/number-keyboard.spec.js new file mode 100644 index 000000000..526a65885 --- /dev/null +++ b/test/unit/specs/number-keyboard.spec.js @@ -0,0 +1,146 @@ +import NumberKeyboard from 'packages/number-keyboard'; +import { mount } from 'avoriaz'; +import { triggerTouch } from '../utils'; + +function mockKeyDown(wrapper, keyIndex) { + const customEvent = document.createEvent('CustomEvent'); + customEvent.initCustomEvent('touchstart', true, true, {}); + Object.defineProperty(customEvent, 'target', { + value: { + dataset: { + key: keyIndex + } + } + }); + wrapper.element.dispatchEvent(customEvent); +} + +describe('NumberKeyboard', () => { + let wrapper; + afterEach(() => { + wrapper && wrapper.destroy(); + }); + + it('create a NumberKeyboard', () => { + wrapper = mount(NumberKeyboard, {}); + expect(wrapper.hasClass('van-number-keyboard')).to.be.true; + }); + + it('click a keyboard key', (done) => { + wrapper = mount(NumberKeyboard, {}); + + // just for coverage + wrapper.vm.handler(true); + + wrapper.vm.$on('input', value => { + expect(value).to.equal(1); + expect(wrapper.vm.active).to.equal(0); + + triggerTouch(wrapper, 'touchend'); + expect(wrapper.vm.active).to.equal(-1); + done(); + }); + + mockKeyDown(wrapper, 9); + mockKeyDown(wrapper, NaN); + mockKeyDown(wrapper, 0); + }); + + it('click delete key', (done) => { + wrapper = mount(NumberKeyboard, {}); + + const deleteSpy = sinon.spy(); + wrapper.vm.$on('delete', deleteSpy); + + mockKeyDown(wrapper, 11); + wrapper.vm.$nextTick(() => { + expect(deleteSpy.calledOnce).to.be.true; + done(); + }); + }); + + it('blur keyboard', (done) => { + wrapper = mount(NumberKeyboard, { + attachToDocument: true + }); + + const blur = sinon.spy(); + wrapper.vm.$on('blur', blur); + + triggerTouch(document.body, 'touchstart'); + wrapper.vm.$nextTick(() => { + expect(blur.calledOnce).to.be.true; + done(); + }); + }); + + it('listen to show event when has transtion', (done) => { + wrapper = mount(NumberKeyboard, { + attachToDocument: true + }); + + const show = sinon.spy(); + wrapper.vm.$on('show', show); + wrapper.vm.show = true; + + setTimeout(() => { + expect(show.calledOnce).to.be.true; + done(); + }, 800); + }); + + it('listen to show event when no transtion', (done) => { + wrapper = mount(NumberKeyboard, { + attachToDocument: true, + propsData: { + transition: false + } + }); + + const show = sinon.spy(); + wrapper.vm.$on('show', show); + wrapper.vm.show = true; + + wrapper.vm.$nextTick(() => { + expect(show.calledOnce).to.be.true; + done(); + }); + }); + + it('listen to hide event when has transtion', (done) => { + wrapper = mount(NumberKeyboard, { + attachToDocument: true, + propsData: { + show: true + } + }); + + const hide = sinon.spy(); + wrapper.vm.$on('hide', hide); + wrapper.vm.show = false; + + setTimeout(() => { + expect(hide.calledOnce).to.be.true; + done(); + }, 800); + }); + + it('listen to hide event when no transtion', (done) => { + wrapper = mount(NumberKeyboard, { + attachToDocument: true, + propsData: { + show: true, + transition: false + } + }); + + const hide = sinon.spy(); + wrapper.vm.$on('hide', hide); + wrapper.vm.show = false; + + wrapper.vm.$nextTick(() => { + expect(hide.calledOnce).to.be.true; + done(); + }); + }); +}); From c4f11baf7cceaf4109cec15e79d0e2b143bf4809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 11 Sep 2017 10:22:12 +0800 Subject: [PATCH 03/18] NumberKeyboard: fix test cases fail --- test/unit/components/number-keyboard.vue | 19 ++++++++++++++ test/unit/specs/number-keyboard.spec.js | 32 +++++++++++++++++------- 2 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 test/unit/components/number-keyboard.vue diff --git a/test/unit/components/number-keyboard.vue b/test/unit/components/number-keyboard.vue new file mode 100644 index 000000000..b6cd28b8d --- /dev/null +++ b/test/unit/components/number-keyboard.vue @@ -0,0 +1,19 @@ + + + diff --git a/test/unit/specs/number-keyboard.spec.js b/test/unit/specs/number-keyboard.spec.js index 526a65885..d096722e4 100644 --- a/test/unit/specs/number-keyboard.spec.js +++ b/test/unit/specs/number-keyboard.spec.js @@ -1,17 +1,12 @@ import NumberKeyboard from 'packages/number-keyboard'; +import NumberKeyboardKeepAlive from '../components/number-keyboard'; import { mount } from 'avoriaz'; import { triggerTouch } from '../utils'; function mockKeyDown(wrapper, keyIndex) { const customEvent = document.createEvent('CustomEvent'); customEvent.initCustomEvent('touchstart', true, true, {}); - Object.defineProperty(customEvent, 'target', { - value: { - dataset: { - key: keyIndex - } - } - }); + wrapper.element.dataset.key = keyIndex; wrapper.element.dispatchEvent(customEvent); } @@ -82,11 +77,12 @@ describe('NumberKeyboard', () => { const show = sinon.spy(); wrapper.vm.$on('show', show); wrapper.vm.show = true; + wrapper.trigger('animationend'); setTimeout(() => { expect(show.calledOnce).to.be.true; done(); - }, 800); + }, 100); }); it('listen to show event when no transtion', (done) => { @@ -118,11 +114,12 @@ describe('NumberKeyboard', () => { const hide = sinon.spy(); wrapper.vm.$on('hide', hide); wrapper.vm.show = false; + wrapper.trigger('animationend'); setTimeout(() => { expect(hide.calledOnce).to.be.true; done(); - }, 800); + }, 100); }); it('listen to hide event when no transtion', (done) => { @@ -143,4 +140,21 @@ describe('NumberKeyboard', () => { done(); }); }); + + it('keey-alive live cycle', (done) => { + wrapper = mount(NumberKeyboardKeepAlive, { + attachToDocument: true, + propsData: { + showKeyboard: true + } + }); + + expect(wrapper.find('.van-number-keyboard').length).to.equal(1); + + wrapper.vm.showKeyboard = false; + wrapper.vm.$nextTick(() => { + expect(wrapper.find('.van-number-keyboard').length).to.equal(0); + done(); + }); + }); }); From eb724555cb62d42c58273e7294ff69ed00005e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 11 Sep 2017 11:31:03 +0800 Subject: [PATCH 04/18] add PasswordInput component --- docs/examples-docs/password-input.md | 88 ++++++++++++++++++++++++ docs/src/doc.config.js | 4 ++ packages/index.js | 3 + packages/password-input/index.vue | 43 ++++++++++++ packages/vant-css/src/index.css | 1 + packages/vant-css/src/password-input.css | 59 ++++++++++++++++ test/unit/specs/password-input.spec.js | 56 +++++++++++++++ 7 files changed, 254 insertions(+) create mode 100644 docs/examples-docs/password-input.md create mode 100644 packages/password-input/index.vue create mode 100644 packages/vant-css/src/password-input.css create mode 100644 test/unit/specs/password-input.spec.js diff --git a/docs/examples-docs/password-input.md b/docs/examples-docs/password-input.md new file mode 100644 index 000000000..440e96475 --- /dev/null +++ b/docs/examples-docs/password-input.md @@ -0,0 +1,88 @@ + + +## PasswordInput 密码输入框 +密码输入框组件通常与 [数字键盘](/zanui/vue/component/number-keyboard) 组件配合使用 + +### 使用指南 +``` javascript +import { PasswordInput, NumberKeyBoard } from 'vant'; + +Vue.component(PasswordInput.name, PasswordInput); +Vue.component(NumberKeyBoard.name, NumberKeyBoard); +``` + +### 代码演示 + +#### 基础用法 + +:::demo 基础用法 +```html + + + + + +``` + +```javascript +export default { + data() { + return { + value: '', + showKeyboard: true + } + }, + + methods: { + onInput(key) { + this.value = (this.value + key).slice(0, 6); + }, + onDelete() { + this.value = this.value.slice(0, this.value.length - 1); + } + } +} +``` +::: + +### API + +| 参数 | 说明 | 类型 | 默认值 | 可选值 | +|-----------|-----------|-----------|-------------|-------------| +| value | 密码值 | `String` | `''` | - | +| length | 密码长度 | `Number` | `6` | - | +| info | 输入框下方提示 | `String` | - | - | +| errorInfo | 输入框下方错误提示 | `String` | - | - | + +### Event + +| 事件名 | 说明 | 参数 | +|-----------|-----------|-----------| +| focus | 输入框聚焦时触发 | - | diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index 2451493c9..0e42554c6 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -147,6 +147,10 @@ module.exports = { "path": "/number-keyboard", "title": "NumberKeyboard 数字键盘" }, + { + "path": "/password-input", + "title": "PasswordInput 密码输入框" + }, { "path": "/radio", "title": "Radio 单选框" diff --git a/packages/index.js b/packages/index.js index 831cd0d82..f617e8870 100644 --- a/packages/index.js +++ b/packages/index.js @@ -26,6 +26,7 @@ import NavBar from './nav-bar'; import NoticeBar from './notice-bar'; import NumberKeyboard from './number-keyboard'; import Panel from './panel'; +import PasswordInput from './password-input'; import Picker from './picker'; import Popup from './popup'; import Progress from './progress'; @@ -78,6 +79,7 @@ const components = [ NoticeBar, NumberKeyboard, Panel, + PasswordInput, Picker, Popup, Progress, @@ -146,6 +148,7 @@ export { NoticeBar, NumberKeyboard, Panel, + PasswordInput, Picker, Popup, Progress, diff --git a/packages/password-input/index.vue b/packages/password-input/index.vue new file mode 100644 index 000000000..2f16aed3a --- /dev/null +++ b/packages/password-input/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/vant-css/src/index.css b/packages/vant-css/src/index.css index 9585bd21a..dc819043f 100644 --- a/packages/vant-css/src/index.css +++ b/packages/vant-css/src/index.css @@ -34,6 +34,7 @@ @import './radio.css'; @import './switch.css'; @import './uploader.css'; +@import './password-input.css'; @import './number-keyboard.css'; /* action components */ diff --git a/packages/vant-css/src/password-input.css b/packages/vant-css/src/password-input.css new file mode 100644 index 000000000..eb6a64982 --- /dev/null +++ b/packages/vant-css/src/password-input.css @@ -0,0 +1,59 @@ +@import "./common/var.css"; + +.van-password-input { + margin: 0 15px; + user-select: none; + position: relative; + + &:focus { + outline: none; + } + + &__info, + &__error-info { + font-size: 14px; + margin-top: 15px; + text-align: center; + } + + &__info { + color: $gray-dark; + } + + &__error-info { + color: $red; + } + + &__security { + width: 100%; + height: 50px; + display: flex; + background-color: $white; + + &::after { + border-radius: 6px; + } + + li { + flex: 1; + height: 100%; + position: relative; + + &:not(:first-of-type)::after { + border-left-width: 1px; + } + } + + i { + position: absolute; + left: 50%; + top: 50%; + width: 10px; + height: 10px; + margin: -5px 0 0 -5px; + visibility: hidden; + border-radius: 100%; + background-color: $black; + } + } +} diff --git a/test/unit/specs/password-input.spec.js b/test/unit/specs/password-input.spec.js new file mode 100644 index 000000000..e5ce480d5 --- /dev/null +++ b/test/unit/specs/password-input.spec.js @@ -0,0 +1,56 @@ +import PasswordInput from 'packages/password-input'; +import { mount } from 'avoriaz'; + +describe('PasswordInput', () => { + let wrapper; + afterEach(() => { + wrapper && wrapper.destroy(); + }); + + it('create a PasswordInput', () => { + wrapper = mount(PasswordInput, {}); + expect(wrapper.find('.van-password-input').length).to.equal(1); + }); + + it('create a PasswordInput with value && info', (done) => { + wrapper = mount(PasswordInput, { + propsData: { + value: '000', + info: '测试info' + } + }); + + expect(wrapper.find('.van-password-input i')[2].hasStyle('visibility', 'visible')).to.be.true; + expect(wrapper.find('.van-password-input i')[3].hasStyle('visibility', 'visible')).to.be.false; + expect(wrapper.find('.van-password-input__info')[0].text()).to.equal('测试info'); + + wrapper.vm.value = '0000'; + wrapper.vm.errorInfo = '测试errorInfo'; + wrapper.vm.$nextTick(() => { + expect(wrapper.find('.van-password-input i')[3].hasStyle('visibility', 'visible')).to.be.true; + expect(wrapper.find('.van-password-input__info').length).to.equal(0); + expect(wrapper.find('.van-password-input__error-info')[0].text()).to.equal('测试errorInfo'); + done(); + }); + }); + + it('listen to focus event', () => { + wrapper = mount(PasswordInput, {}); + + const focus = sinon.spy(); + wrapper.vm.$on('focus', focus); + wrapper.find('.van-password-input__security')[0].trigger('touchstart'); + + expect(focus.calledOnce).to.be.true; + }); + + it('change password length', () => { + wrapper = mount(PasswordInput, { + propsData: { + length: 2 + } + }); + + expect(wrapper.find('.van-password-input i').length).to.equal(2); + }); +}); From c4510aa8e05313120df3acbe8e27adb0b26477e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Wed, 13 Sep 2017 13:34:32 +0800 Subject: [PATCH 05/18] Build: remove optimize-css-assets-webpack-plugin --- build/webpack.config.dev.js | 4 +-- package.json | 1 - yarn.lock | 71 +++++++++++++++++++++---------------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js index a70c778a0..2a1b95031 100644 --- a/build/webpack.config.dev.js +++ b/build/webpack.config.dev.js @@ -1,9 +1,8 @@ const webpack = require('webpack'); const path = require('path'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ProgressBarPlugin = require('progress-bar-webpack-plugin'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin'); const isProduction = process.env.NODE_ENV === 'production'; const docConfig = require('../docs/src/doc.config'); @@ -127,7 +126,6 @@ module.exports = { minChunks: 2, filename: isProduction ? 'vendor.[hash:8].js' : 'vendor.js' }), - new OptimizeCssAssetsPlugin(), new ExtractTextPlugin({ filename: isProduction ? '[name].[hash:8].css' : '[name].css', allChunks: true diff --git a/package.json b/package.json index 65ac938cd..f76835748 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "markdown-it": "^8.4.0", "markdown-it-container": "^2.0.0", "mocha": "^3.4.2", - "optimize-css-assets-webpack-plugin": "^3.1.1", "postcss": "^6.0.10", "postcss-easy-import": "^2.1.0", "postcss-loader": "^2.0.6", diff --git a/yarn.lock b/yarn.lock index f62d7febb..595547dbb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -323,14 +323,14 @@ autoprefixer@^6.3.1: postcss-value-parser "^3.2.3" autoprefixer@^7.1.3: - version "7.1.3" - resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-7.1.3.tgz#0e8d337976d6f13644db9f8813b4c42f3d1ccc34" + version "7.1.4" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-7.1.4.tgz#960847dbaa4016bc8e8e52ec891cbf8f1257a748" dependencies: browserslist "^2.4.0" - caniuse-lite "^1.0.30000718" + caniuse-lite "^1.0.30000726" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^6.0.10" + postcss "^6.0.11" postcss-value-parser "^3.2.3" avoriaz@2.0.0: @@ -1195,6 +1195,10 @@ caniuse-lite@^1.0.30000718: version "1.0.30000718" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000718.tgz#0dd24290beb11310b2d80f6b70a823c2a65a6fad" +caniuse-lite@^1.0.30000726: + version "1.0.30000727" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000727.tgz#20c895768398ded5f98a4beab4a76c285def41d2" + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -1713,7 +1717,7 @@ cssesc@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" -"cssnano@>=2.6.1 <4", cssnano@^3.4.0: +"cssnano@>=2.6.1 <4": version "3.10.0" resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38" dependencies: @@ -3343,7 +3347,7 @@ hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" -he@1.1.x, he@^1.1.0: +he@1.1.1, he@1.1.x, he@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -4132,13 +4136,6 @@ klaw@^1.0.0: optionalDependencies: graceful-fs "^4.1.9" -last-call-webpack-plugin@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/last-call-webpack-plugin/-/last-call-webpack-plugin-2.1.1.tgz#bd7af41186b80e6cc3968eee5d65b250eaf791f1" - dependencies: - lodash "^4.17.4" - webpack-sources "^1.0.1" - lazy-cache@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" @@ -4758,8 +4755,8 @@ mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi minimist "0.0.8" mocha@^3.4.2: - version "3.5.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.0.tgz#1328567d2717f997030f8006234bce9b8cd72465" + version "3.5.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d" dependencies: browser-stdout "1.3.0" commander "2.9.0" @@ -4768,6 +4765,7 @@ mocha@^3.4.2: escape-string-regexp "1.0.5" glob "7.1.1" growl "1.9.2" + he "1.1.1" json3 "3.3.2" lodash.create "3.1.1" mkdirp "0.5.1" @@ -5075,13 +5073,6 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optimize-css-assets-webpack-plugin@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-3.1.1.tgz#b86f255a762d9143e3db41a64a136a6b76e8c8a7" - dependencies: - cssnano "^3.4.0" - last-call-webpack-plugin "^2.1.1" - optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" @@ -5815,7 +5806,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.10, postcss@^6.0.2, postcss@^6.0.3, postcss@^6.0.6, postcss@^6.0.9: +postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.2, postcss@^6.0.3, postcss@^6.0.6, postcss@^6.0.9: version "6.0.10" resolved "https://registry.npmjs.org/postcss/-/postcss-6.0.10.tgz#c311b89734483d87a91a56dc9e53f15f4e6e84e4" dependencies: @@ -5823,6 +5814,14 @@ postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.10, postcss@^6.0.2, postcss@^6.0.3, source-map "^0.5.7" supports-color "^4.2.1" +postcss@^6.0.10, postcss@^6.0.11: + version "6.0.11" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.11.tgz#f48db210b1d37a7f7ab6499b7a54982997ab6f72" + dependencies: + chalk "^2.1.0" + source-map "^0.5.7" + supports-color "^4.4.0" + precss@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/precss/-/precss-2.0.0.tgz#7f567e3318e06d44c8fdbf9e58452e8358bf4b71" @@ -6310,12 +6309,18 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.0, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" +rimraf@^2.5.4: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + dependencies: + glob "^7.0.5" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" @@ -6825,6 +6830,12 @@ supports-color@^4.0.0, supports-color@^4.2.1: dependencies: has-flag "^2.0.0" +supports-color@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" + dependencies: + has-flag "^2.0.0" + svgo@^0.7.0: version "0.7.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5" @@ -7311,8 +7322,8 @@ vue-loader@^13.0.4: vue-template-es2015-compiler "^1.5.3" vue-markdown-loader@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/vue-markdown-loader/-/vue-markdown-loader-2.1.0.tgz#112d1921dd56daa29906b7c012623c6c5d6e0d8c" + version "2.2.1" + resolved "https://registry.yarnpkg.com/vue-markdown-loader/-/vue-markdown-loader-2.2.1.tgz#becf0c7455589eb27189fe78a9d5a283bb7acc00" dependencies: cheerio "^0.20.0" highlight.js "^9.4.0" @@ -7429,8 +7440,8 @@ webpack-sources@^1.0.1: source-map "~0.5.3" webpack@^3.5.5: - version "3.5.5" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.5.5.tgz#3226f09fc8b3e435ff781e7af34f82b68b26996c" + version "3.5.6" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.5.6.tgz#a492fb6c1ed7f573816f90e00c8fbb5a20cc5c36" dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0" @@ -7641,8 +7652,8 @@ yeast@0.1.2: resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" zan-doc@^0.2.12: - version "0.2.12" - resolved "https://registry.npmjs.org/zan-doc/-/zan-doc-0.2.12.tgz#bfbf9a7ec5a4b77a7f53ca1ac030b305432a91c5" + version "0.2.13" + resolved "https://registry.yarnpkg.com/zan-doc/-/zan-doc-0.2.13.tgz#f7345493deacb8cee18c9807150c46c88f86073d" dependencies: cheerio "0.22.0" decamelize "^1.2.0" From fd36e37dc01217e2e5f7baae08f4878a23666dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Wed, 13 Sep 2017 13:35:10 +0800 Subject: [PATCH 06/18] Coupon: not contain popup by default --- docs/examples-docs/coupon.md | 31 ++++++++++++++++++--------- packages/coupon-list/index.vue | 29 +++---------------------- packages/vant-css/src/coupon-list.css | 8 ++++++- 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/docs/examples-docs/coupon.md b/docs/examples-docs/coupon.md index 0f30ee984..fba3aede9 100644 --- a/docs/examples-docs/coupon.md +++ b/docs/examples-docs/coupon.md @@ -1,5 +1,3 @@ -## Coupon 优惠券选择器 - + + +## Coupon 优惠券选择器 + ### 使用指南 ``` javascript import { CouponCell, CouponList } from 'vant'; @@ -81,14 +90,15 @@ Vue.component(CouponList.name, CouponList); > - + + + ``` ```javascript @@ -116,6 +126,7 @@ export default { methods: { onChange(index) { + this.showList = false; this.chosenCoupon = index; }, onExchange(code) { diff --git a/packages/coupon-list/index.vue b/packages/coupon-list/index.vue index 2787e4de9..9a7ddaae9 100644 --- a/packages/coupon-list/index.vue +++ b/packages/coupon-list/index.vue @@ -1,5 +1,5 @@ diff --git a/packages/actionsheet/index.vue b/packages/actionsheet/index.vue index 0ce765aaa..dff11f5da 100644 --- a/packages/actionsheet/index.vue +++ b/packages/actionsheet/index.vue @@ -2,7 +2,7 @@
-

+