From 04ff6821cadbb5f4e43387d3f05cd032a37e2702 Mon Sep 17 00:00:00 2001 From: wny Date: Fri, 20 Oct 2017 02:34:13 -0500 Subject: [PATCH 01/49] [new feature] Sku: sku-group slot add event bus [new feature] Sku: sku-group slot add event bus --- packages/sku/containers/SkuContainer.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sku/containers/SkuContainer.vue b/packages/sku/containers/SkuContainer.vue index 67ba3a85c..d2bc64cac 100644 --- a/packages/sku/containers/SkuContainer.vue +++ b/packages/sku/containers/SkuContainer.vue @@ -12,7 +12,7 @@
- +
Date: Fri, 20 Oct 2017 15:47:22 +0800 Subject: [PATCH 02/49] [build] 0.10.2 --- packages/index.js | 2 +- packages/vant-css/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/index.js b/packages/index.js index c2327901c..d3907a1e8 100644 --- a/packages/index.js +++ b/packages/index.js @@ -59,7 +59,7 @@ import TreeSelect from './tree-select'; import Uploader from './uploader'; import Waterfall from './waterfall'; -const version = '0.10.1'; +const version = '0.10.2'; const components = [ Actionsheet, AddressEdit, diff --git a/packages/vant-css/package.json b/packages/vant-css/package.json index 64f4c8959..9200cb18e 100644 --- a/packages/vant-css/package.json +++ b/packages/vant-css/package.json @@ -1,6 +1,6 @@ { "name": "vant-css", - "version": "0.10.1", + "version": "0.10.2", "description": "vant css.", "main": "lib/index.css", "style": "lib/index.css", From fcafd3a64872a2ed4aa575c6b21e072bfeb3f827 Mon Sep 17 00:00:00 2001 From: pangxie1991 Date: Fri, 20 Oct 2017 15:47:23 +0800 Subject: [PATCH 03/49] [release] 0.10.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be2172adb..e66744050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.10.1", + "version": "0.10.2", "description": "有赞vue wap组件库", "main": "lib/vant.js", "style": "lib/vant-css/index.css", From 1b1b667e935d6602cd11fb3261e65e1b61e11500 Mon Sep 17 00:00:00 2001 From: pangxie1991 Date: Fri, 20 Oct 2017 16:12:24 +0800 Subject: [PATCH 04/49] update changelog --- docs/examples-docs/en-US/changelog.md | 12 ++++++++++ .../zh-CN/changelog-generated.md | 22 +++++++++++++++++++ docs/examples-docs/zh-CN/changelog.md | 12 ++++++++++ 3 files changed, 46 insertions(+) diff --git a/docs/examples-docs/en-US/changelog.md b/docs/examples-docs/en-US/changelog.md index 4302a9597..9580031dc 100644 --- a/docs/examples-docs/en-US/changelog.md +++ b/docs/examples-docs/en-US/changelog.md @@ -1,5 +1,17 @@ ## Changelog +### [0.10.2](https://github.com/youzan/vant/tree/v0.10.2) +`2017-10-20` + +**Improvements** + +- Sku: sku-group slot add event bus [\#226](https://github.com/youzan/vant/pull/226) [@w91](https://github.com/w91) +- add English documents [\#220](https://github.com/youzan/vant/pull/220) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** + +- Optimize component dependency analyze when build style entry [\#224](https://github.com/youzan/vant/pull/224) [@chenjiahan](https://github.com/chenjiahan) + ### [0.10.1](https://github.com/youzan/vant/tree/v0.10.1) `2017-10-18` diff --git a/docs/examples-docs/zh-CN/changelog-generated.md b/docs/examples-docs/zh-CN/changelog-generated.md index e084efc47..1af6aabb8 100644 --- a/docs/examples-docs/zh-CN/changelog-generated.md +++ b/docs/examples-docs/zh-CN/changelog-generated.md @@ -1,5 +1,27 @@ ## 更新日志 +## [v0.10.2](https://github.com/youzan/vant/tree/v0.10.2) (2017-10-20) +[Full Changelog](https://github.com/youzan/vant/compare/v0.10.1...v0.10.2) + +**Bug Fixes** + +- 引入TreeSelect组件后报icon没找到 [\#215](https://github.com/youzan/vant/issues/215) +- Checkbox 复选框组件bug [\#213](https://github.com/youzan/vant/issues/213) + +**Issue** + +- 如何动态赋值 [\#221](https://github.com/youzan/vant/issues/221) +- 省市区的json文件能放出来吗? [\#219](https://github.com/youzan/vant/issues/219) +- 标签页 能提供纵向布局吗?现在只有横向布局 能灵活配置就好了 [\#207](https://github.com/youzan/vant/issues/207) +- 能不能考虑增加一个 “选择图片” 的功能 [\#186](https://github.com/youzan/vant/issues/186) +- Please open source examples code [\#169](https://github.com/youzan/vant/issues/169) + +**Improvements** + +- \[new feature\] Sku: sku-group slot add event bus [\#226](https://github.com/youzan/vant/pull/226) ([w91](https://github.com/w91)) +- \[bugfix\] Optimize component dependency analyze when build style entry [\#224](https://github.com/youzan/vant/pull/224) ([chenjiahan](https://github.com/chenjiahan)) +- \[Doc\] add some english documents [\#220](https://github.com/youzan/vant/pull/220) ([chenjiahan](https://github.com/chenjiahan)) + ## [v0.10.1](https://github.com/youzan/vant/tree/v0.10.1) (2017-10-18) [Full Changelog](https://github.com/youzan/vant/compare/v0.10.0...v0.10.1) diff --git a/docs/examples-docs/zh-CN/changelog.md b/docs/examples-docs/zh-CN/changelog.md index b1dbe7350..5c52a2c57 100644 --- a/docs/examples-docs/zh-CN/changelog.md +++ b/docs/examples-docs/zh-CN/changelog.md @@ -1,5 +1,17 @@ ## 更新日志 +### [0.10.2](https://github.com/youzan/vant/tree/v0.10.2) +`2017-10-20` + +**Improvements** + +- Sku: sku-group slot 增加 event bus [\#226](https://github.com/youzan/vant/pull/226) [@w91](https://github.com/w91) +- 增加英文文档翻译 [\#220](https://github.com/youzan/vant/pull/220) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** + +- 修复组件样式依赖分析 [\#224](https://github.com/youzan/vant/pull/224) [@chenjiahan](https://github.com/chenjiahan) + ### [0.10.1](https://github.com/youzan/vant/tree/v0.10.1) `2017-10-18` From 3092d55fa916608fe39a8a07879d3167de3db812 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 20 Oct 2017 03:20:19 -0500 Subject: [PATCH 05/49] update README.md (#227) * [bugfix] Checkbox border render error in weixin browser * [bugfix] TreeSelect dependency path error * [bugfix] Swipe should clear autoplay timer when destroyed * [bugfix] Optimize component dependency analyze when build style entry * merge * update yarn.lock * update README.md * update README.md * update README.md * update README.md * update README.md --- README.md | 77 ++++++++++++++++++++++++++++++++++++++++++--- README.zh-CN.md | 83 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 150 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 68fa8e9b2..fc01b343e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,18 @@ [访问中文版](./README.zh-CN.md) +## Features + +- Components come from wechat mall business of [YouZan](https://youzan.com) +- Extensive documentation and demos. +- Support [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) +- Unit test coverage over 90% +- Not only have the basic components, but also have a lot of business components + +

+ feature demo +

+ ## Install ```shell @@ -18,14 +30,71 @@ npm i -S vant ``` ## Quickstart -See [Quickstart](https://www.youzanyun.com/zanui/vue#/en-US/component/quickstart). - -## How to contribute +#### 1. Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (Recommended) +```bash +# Install babel-plugin-import +npm i babel-plugin-import -D +``` + +```js +// set babel config in .babelrc or babel-loader +{ + "plugins": [ + ["import", { "libraryName": "vant", "style": true }] + ] +} +``` + +Then you can import components from vant, equivalent to import manually below. + +```js +import { Button } from 'vant'; +``` + +#### 2. Manually import + +```js +import { Button } from 'vant/lib/button'; +import 'vant/lib/vant-css/base.css'; +import 'vant/lib/vant-css/button.css'; +``` + +#### 3. Import all components + +```js +import Vue from 'vue'; +import Vant from 'vant'; +import 'vant/lib/vant-css/index.css'; + +Vue.use(Vant); +``` + +### CDN + +```html + + + + + +``` + +See more in [Quickstart](https://www.youzanyun.com/zanui/vue#/en-US/component/quickstart). + +## Contribution Please make sure to read the [Contributing Guide](./.github/CONTRIBUTING.md) before making a pull request. -## Preview +## Browser Support +Modern browsers and Android 4.0+, iOS 6+. +## Links +- [Documentation](https://www.youzanyun.com/zanui/vue) +- [Change log](https://www.youzanyun.com/zanui/vue#/en-US/component/changelog) +- [React UI Zent](https://www.youzanyun.com/zanui/react) +- [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) + +## Preview You can scan the following QR code to access the demo: ![zanui_vue_mobile_qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) diff --git a/README.zh-CN.md b/README.zh-CN.md index 0df28304e..81bea1d12 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -8,28 +8,99 @@

A Vue.js 2.0 Mobile UI at YouZan

[![Build Status](https://travis-ci.org/youzan/vant.svg?branch=master)](https://travis-ci.org/youzan/vant) [![Coverage Status](https://img.shields.io/codecov/c/github/youzan/vant/dev.svg)](https://codecov.io/github/youzan/vant?branch=dev) [![npm version](https://img.shields.io/npm/v/vant.svg?style=flat)](https://www.npmjs.com/package/vant) [![downloads](https://img.shields.io/npm/dt/vant.svg)](https://www.npmjs.com/package/vant) + +## 特性 + +- 组件都是来源于有赞的微商城业务,并且经过有赞业务的检验,更靠谱 +- 丰富的文档和Demo +- 支持 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) +- 单元测试覆盖率超过90% +- 不仅仅有丰富的基础组件,还有许多的业务组件 + +

+ feature demo +

-## 一、安装 +## 安装 ```shell npm i -S vant ``` -## 二、快速上手 -参考 [Quickstart](https://www.youzanyun.com/zanui/vue#/zh-CN/component/quickstart). +## 快速上手 -## 三、贡献代码 +#### 方式一. 使用 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (推荐) +```bash +# 安装 babel-plugin-import 插件 +npm i babel-plugin-import -D +``` + +```js +// 在 .babelrc 或 babel-loader 中添加插件配置 +{ + "plugins": [ + ["import", { "libraryName": "vant", "style": true }] + ] +} +``` + +接着你可以在代码中直接引入 Vant 组件,插件会自动将代码转化为方式二中的按需引入形式。 + +```js +import { Button } from 'vant'; +``` + +#### 方式二. 按需引入组件 + +```js +import { Button } from 'vant/lib/button'; +import 'vant/lib/vant-css/base.css'; +import 'vant/lib/vant-css/button.css'; +``` + +#### 方式三. 导入所有组件 + +```js +import Vue from 'vue'; +import Vant from 'vant'; +import 'vant/lib/vant-css/index.css'; + +Vue.use(Vant); +``` + +### CDN + +```html + + + + + +``` + +更多内容请参考 [快速上手](https://www.youzanyun.com/zanui/vue#/zh-CN/component/quickstart). + +## 贡献代码 修改代码请阅读我们的 [开发指南](./.github/CONTRIBUTING.zh-CN.md)。 使用过程中发现任何问题都可以提 [Issue](https://github.com/youzan/vant/issues) 给我们,当然,我们也非常欢迎你给我们发 [PR](https://github.com/youzan/vant/pulls)。 -## 四、手机预览 +## 浏览器支持 +现代浏览器以及 Android 4.0+, iOS 6+. + +## 手机预览 可以手机扫码以下二维码访问手机端demo: ![zanui_vue_mobile_qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) + +## 链接 +- [详细文档](https://www.youzanyun.com/zanui/vue) +- [更新日志](https://www.youzanyun.com/zanui/vue#/en-US/component/changelog) +- [React 组件库 Zent](https://www.youzanyun.com/zanui/react) +- [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) -## 五、开源协议 +## 开源协议 本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89) 协议,请自由地享受和参与开源。 From c1923bc87ddb052ea478ebbc2534327cd3b34f8a Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 20 Oct 2017 03:53:46 -0500 Subject: [PATCH 06/49] [Doc] add more badges in README.md (#228) * [bugfix] Checkbox border render error in weixin browser * [bugfix] TreeSelect dependency path error * [bugfix] Swipe should clear autoplay timer when destroyed * [bugfix] Optimize component dependency analyze when build style entry * merge * update yarn.lock * update README.md * update README.md * update README.md * update README.md * update README.md * [Doc] add more badges in README.md * update README.md --- README.md | 6 +++++- README.zh-CN.md | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc01b343e..161c8d87c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,11 @@

A Vue.js 2.0 Mobile UI at YouZan

-[![Build Status](https://travis-ci.org/youzan/vant.svg?branch=master)](https://travis-ci.org/youzan/vant) [![Coverage Status](https://img.shields.io/codecov/c/github/youzan/vant/dev.svg)](https://codecov.io/github/youzan/vant?branch=dev) [![npm version](https://img.shields.io/npm/v/vant.svg?style=flat)](https://www.npmjs.com/package/vant) [![downloads](https://img.shields.io/npm/dt/vant.svg)](https://www.npmjs.com/package/vant) +[![Build Status](https://travis-ci.org/youzan/vant.svg?branch=master)](https://travis-ci.org/youzan/vant) +[![downloads](https://img.shields.io/npm/dt/vant.svg)](https://www.npmjs.com/package/vant) +[![Coverage Status](https://img.shields.io/codecov/c/github/youzan/vant/dev.svg)](https://codecov.io/github/youzan/vant?branch=dev) +[![npm version](https://img.shields.io/npm/v/vant.svg?style=flat)](https://www.npmjs.com/package/vant) +[![license](https://img.shields.io/npm/l/vant.svg)](https://www.npmjs.com/package/vant) [访问中文版](./README.zh-CN.md) diff --git a/README.zh-CN.md b/README.zh-CN.md index 81bea1d12..b6bc4b9ba 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -7,8 +7,12 @@

A Vue.js 2.0 Mobile UI at YouZan

-[![Build Status](https://travis-ci.org/youzan/vant.svg?branch=master)](https://travis-ci.org/youzan/vant) [![Coverage Status](https://img.shields.io/codecov/c/github/youzan/vant/dev.svg)](https://codecov.io/github/youzan/vant?branch=dev) [![npm version](https://img.shields.io/npm/v/vant.svg?style=flat)](https://www.npmjs.com/package/vant) [![downloads](https://img.shields.io/npm/dt/vant.svg)](https://www.npmjs.com/package/vant) - +[![Build Status](https://travis-ci.org/youzan/vant.svg?branch=master)](https://travis-ci.org/youzan/vant) +[![downloads](https://img.shields.io/npm/dt/vant.svg)](https://www.npmjs.com/package/vant) +[![Coverage Status](https://img.shields.io/codecov/c/github/youzan/vant/dev.svg)](https://codecov.io/github/youzan/vant?branch=dev) +[![npm version](https://img.shields.io/npm/v/vant.svg?style=flat)](https://www.npmjs.com/package/vant) +[![license](https://img.shields.io/npm/l/vant.svg)](https://www.npmjs.com/package/vant) + ## 特性 - 组件都是来源于有赞的微商城业务,并且经过有赞业务的检验,更靠谱 From 0884cad22782dfc4f96f78c428a1bd94f76cf401 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 22 Oct 2017 21:01:30 -0500 Subject: [PATCH 07/49] [bugfix] Address & Contact list style (#230) * [bugfix] Checkbox border render error in weixin browser * [bugfix] TreeSelect dependency path error * [bugfix] Swipe should clear autoplay timer when destroyed * [bugfix] Optimize component dependency analyze when build style entry * merge * update yarn.lock * update README.md * update README.md * update README.md * update README.md * update README.md * [Doc] add more badges in README.md * update README.md * [bugfix] Address & Contact list style * fix: contact test cases --- build/bin/build-style-entry.js | 3 ++- packages/contact-card/index.vue | 4 ++-- packages/vant-css/src/address-list.css | 3 +++ packages/vant-css/src/contact-list.css | 4 ++++ test/unit/specs/contact.spec.js | 4 ++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build/bin/build-style-entry.js b/build/bin/build-style-entry.js index 525d34502..e4f61af5a 100644 --- a/build/bin/build-style-entry.js +++ b/build/bin/build-style-entry.js @@ -24,13 +24,14 @@ function analyzeDependencies(componentName, libDir) { }) const checkList = ['base']; search(dependencies, checkList); + console.log(componentName ,checkList); return checkList.filter(component => checkComponentHasStyle(component)); } function search(tree, checkList) { tree && Object.keys(tree).forEach(key => { search(tree[key], checkList); - const component = key.split('/vant/lib/')[1].replace('/index.js', ''); + const component = key.split('/vant/lib/')[1].replace('/index.js', '').replace('mixins/', ''); if (checkList.indexOf(component) === -1) { checkList.push(component); } diff --git a/packages/contact-card/index.vue b/packages/contact-card/index.vue index af42b6c79..ffc61b455 100644 --- a/packages/contact-card/index.vue +++ b/packages/contact-card/index.vue @@ -8,8 +8,8 @@
diff --git a/packages/vant-css/src/address-list.css b/packages/vant-css/src/address-list.css index 8354ed70d..d6ad57b7b 100644 --- a/packages/vant-css/src/address-list.css +++ b/packages/vant-css/src/address-list.css @@ -27,7 +27,10 @@ &__group { height: 100%; overflow-y: scroll; + padding-bottom: 40px; + box-sizing: border-box; -webkit-overflow-scrolling: touch; + background-color: $background-color; } &__name { diff --git a/packages/vant-css/src/contact-list.css b/packages/vant-css/src/contact-list.css index 929a5192d..bff41eb7a 100644 --- a/packages/vant-css/src/contact-list.css +++ b/packages/vant-css/src/contact-list.css @@ -2,6 +2,10 @@ .van-contact-list { height: 100%; + overflow-y: auto; + padding-bottom: 55px; + box-sizing: border-box; + background-color: $background-color; .van-cell__value { color: $text-color; diff --git a/test/unit/specs/contact.spec.js b/test/unit/specs/contact.spec.js index ed7e8044c..213516bb1 100644 --- a/test/unit/specs/contact.spec.js +++ b/test/unit/specs/contact.spec.js @@ -41,8 +41,8 @@ describe('ContactCard', () => { }); expect(wrapper.hasClass('van-contact-card')).to.be.true; - expect(wrapper.find('.van-contact-card__text p')[0].text()).to.equal('联系人:测试姓名'); - expect(wrapper.find('.van-contact-card__text p')[1].text()).to.equal('联系电话:13000000000'); + expect(wrapper.find('.van-contact-card__text div')[0].text()).to.equal('联系人:测试姓名'); + expect(wrapper.find('.van-contact-card__text div')[1].text()).to.equal('联系电话:13000000000'); }); }); From 5a1c20d0a653452a9fae35e644c13fc7172f3602 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 22 Oct 2017 21:06:39 -0500 Subject: [PATCH 08/49] [bugfix] popup style missing when build style entry (#231) * [bugfix] Checkbox border render error in weixin browser * [bugfix] TreeSelect dependency path error * [bugfix] Swipe should clear autoplay timer when destroyed * [bugfix] Optimize component dependency analyze when build style entry * merge * update yarn.lock * update README.md * update README.md * update README.md * update README.md * update README.md * [Doc] add more badges in README.md * update README.md * [bugfix] Address & Contact list style * fix: contact test cases * [bugfix] popup style missing when build style entry --- build/bin/build-style-entry.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/build/bin/build-style-entry.js b/build/bin/build-style-entry.js index e4f61af5a..a760de350 100644 --- a/build/bin/build-style-entry.js +++ b/build/bin/build-style-entry.js @@ -9,22 +9,18 @@ const dependencyTree = require('dependency-tree'); components.forEach(componentName => { const libDir = path.resolve(__dirname, '../../lib'); - const dependencies = analyzeDependencies(componentName, libDir); - const styleDir = path.join(libDir, componentName, '/style'); - const content = dependencies.map(component => `require('../../vant-css/${component}.css');`); - fs.outputFileSync(path.join(styleDir, './index.js'), content.join('\n')); + const content = analyzeDependencies(componentName, libDir).map(component => `require('../../vant-css/${component}.css');`); + fs.outputFileSync(path.join(libDir, componentName, './style/index.js'), content.join('\n')); }); // Analyze component dependencies function analyzeDependencies(componentName, libDir) { - const dependencies = dependencyTree({ + const checkList = ['base']; + search(dependencyTree({ directory: libDir, filename: path.resolve(libDir, componentName, 'index.js'), filter: path => path.indexOf('vant/lib/') !== -1 - }) - const checkList = ['base']; - search(dependencies, checkList); - console.log(componentName ,checkList); + }), checkList); return checkList.filter(component => checkComponentHasStyle(component)); } @@ -39,10 +35,5 @@ function search(tree, checkList) { } function checkComponentHasStyle(componentName) { - const cssPath = path.join(__dirname, '../../lib/vant-css/', `${componentName}.css`); - return fs.existsSync(cssPath); -} - -function toPascal(str) { - return ('_' + str).replace(/[_.-](\w|$)/g, (_, x) => x.toUpperCase()); + return fs.existsSync(path.join(__dirname, '../../lib/vant-css/', `${componentName}.css`)); } From 6efaa1e132a373eeedce96f3c9755294a2587198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 23 Oct 2017 21:43:48 +0800 Subject: [PATCH 09/49] [Doc] add vant-demo link --- README.md | 1 + README.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 161c8d87c..422edb40d 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Modern browsers and Android 4.0+, iOS 6+. - [Change log](https://www.youzanyun.com/zanui/vue#/en-US/component/changelog) - [React UI Zent](https://www.youzanyun.com/zanui/react) - [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) +- [vant-demo](https://github.com/chenjiahan/vant-demo) ## Preview You can scan the following QR code to access the demo: diff --git a/README.zh-CN.md b/README.zh-CN.md index b6bc4b9ba..bb26664a1 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -104,6 +104,7 @@ Vue.use(Vant); - [更新日志](https://www.youzanyun.com/zanui/vue#/en-US/component/changelog) - [React 组件库 Zent](https://www.youzanyun.com/zanui/react) - [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) +- [vant-demo](https://github.com/chenjiahan/vant-demo) ## 开源协议 From 7e5dae322162eb083c6e853e613f719eb7a57f2f Mon Sep 17 00:00:00 2001 From: WyTiny Date: Tue, 24 Oct 2017 00:30:12 -0500 Subject: [PATCH 10/49] fix: en (#236) [Doc] add Advanced components english document --- docs/examples-docs/en-US/cell-swipe.md | 16 ++--- docs/examples-docs/en-US/switch-cell.md | 20 +++---- docs/examples-docs/en-US/tree-select.md | 77 +++++++++++++------------ 3 files changed, 57 insertions(+), 56 deletions(-) diff --git a/docs/examples-docs/en-US/cell-swipe.md b/docs/examples-docs/en-US/cell-swipe.md index c5313a6d2..3b0cc1073 100644 --- a/docs/examples-docs/en-US/cell-swipe.md +++ b/docs/examples-docs/en-US/cell-swipe.md @@ -14,11 +14,11 @@ Vue.component(CellSwipe.name, CellSwipe); :::demo Basic Usage ```html - 选择 + Select - + - 删除 + Delete/span> ``` ::: @@ -27,13 +27,13 @@ Vue.component(CellSwipe.name, CellSwipe); | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| -| left-width | 左侧滑动区域宽度 | `Number` | `0` | - | -| right-width | 右侧滑动区域宽度 | `Number` | `0` | - | +| left-width | Width of the left scrollable area | `Number` | `0` | - | +| right-width | Width of the right scrollable area | `Number` | `0` | - | ### Slot | name | Description | |-----------|-----------| -| - | 自定义显示内容 | -| left | 左侧滑动内容 | -| right | 右侧滑动内容 | +| - | custom content | +| left | content of left scrollable area | +| right | content of right scrollabe area | diff --git a/docs/examples-docs/en-US/switch-cell.md b/docs/examples-docs/en-US/switch-cell.md index 24a872f72..cc7f20362 100644 --- a/docs/examples-docs/en-US/switch-cell.md +++ b/docs/examples-docs/en-US/switch-cell.md @@ -1,6 +1,6 @@ ## SwitchCell -`SwitchCell`组件是对`Switch`和`Cell`组件的封装 +`SwitchCell` component is an encapsulation of `Switch` and `Cell`. diff --git a/docs/src/ExamplesApp.vue b/docs/src/WapApp.vue similarity index 100% rename from docs/src/ExamplesApp.vue rename to docs/src/WapApp.vue diff --git a/docs/src/components/demo.vue b/docs/src/components/demo.vue new file mode 100644 index 000000000..46b120468 --- /dev/null +++ b/docs/src/components/demo.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index 4bb19a109..a5cf2fe79 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -28,12 +28,18 @@ module.exports = { }, { title: '业务组件', - link: '/zanui/captain/component/quickstart' + link: '/zanui/captain' }, { path: '/changelog', title: '更新日志', noExample: true + }, + { + path: '/demo', + title: '示例页面', + noDocument: true, + noExample: true } ] } diff --git a/docs/src/examples.js b/docs/src/examples.js index 3d8eef83b..60b8e7d06 100644 --- a/docs/src/examples.js +++ b/docs/src/examples.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; -import App from './ExamplesApp'; +import App from './WapApp'; import routes from './router.config'; import { setLang } from './utils/lang'; import Vant, { Lazyload } from 'packages'; diff --git a/docs/src/index.js b/docs/src/index.js index 0d2946522..8eea7e664 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; -import App from './ExamplesDocsApp'; +import App from './DocsApp'; import routes from './router.config'; import ZanDoc from 'zan-doc'; import isMobile from './utils/is-mobile'; diff --git a/docs/src/router.config.js b/docs/src/router.config.js index 257231f08..9f681de18 100644 --- a/docs/src/router.config.js +++ b/docs/src/router.config.js @@ -3,19 +3,16 @@ import { getLang } from './utils/lang'; import DemoList from './components/demo-list'; import componentDocs from '../examples-dist/entry-docs'; import componentDemos from '../examples-dist/entry-demos'; +import Demo from './components/demo'; import './utils/iframe-router'; const registerRoute = (isExample) => { const route = [{ path: '/', - redirect: to => { - return `/${getLang()}/`; - } + redirect: to => `/${getLang()}/` }, { path: '*', - redirect: to => { - return `/${getLang()}/`; - } + redirect: to => `/${getLang()}/` }]; Object.keys(docConfig).forEach((lang, index) => { @@ -53,9 +50,18 @@ const registerRoute = (isExample) => { const { path } = page; if (path) { const name = lang + '/' + path.replace('/', ''); + let component; + + if (path === '/demo') { + component = Demo; + } else { + component = isExample ? componentDemos[name] : componentDocs[name]; + } + route.push({ + name, + component, path: `/${lang}/component${path}`, - component: isExample ? componentDemos[name] : componentDocs[name], meta: { lang } }); } diff --git a/package.json b/package.json index e66744050..8036d513d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "vue": ">= 2.4.0" }, "devDependencies": { - "autoprefixer": "^7.1.3", + "autoprefixer": "^7.1.6", "avoriaz": "2.0.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", @@ -119,6 +119,6 @@ "webpack-bundle-analyzer": "^2.9.0", "webpack-dev-server": "^2.9.2", "webpack-merge": "^4.1.0", - "zan-doc": "^0.3.6" + "zan-doc": "^0.3.8" } } diff --git a/packages/cell/index.vue b/packages/cell/index.vue index 0f43adcef..bd090512d 100644 --- a/packages/cell/index.vue +++ b/packages/cell/index.vue @@ -1,15 +1,12 @@ ``` -### 自定义主题 - -`Vant`提供了一套默认主题,CSS 命名采用 BEM 的风格,方便使用者覆盖样式。如果你想完全替换主题色或者部分样式,可以使用下面的方法: - -#### 下载主题 - -可以通过 Github 或 npm 来下载主题: - -```bash -# npm -npm i vant-css -D - -# github -git clone git@github.com:youzan/vant.git -cd packages/vant-css -``` - -#### 修改主题 - -修改你下载主题对应的样式即可,然后引入你修改后的主题。 - ### vue-cli 模板 可以使用`vue-cli`来初始化`Vant`的通用模板: diff --git a/docs/examples-docs/zh-CN/theme.md b/docs/examples-docs/zh-CN/theme.md new file mode 100644 index 000000000..cc6a3340a --- /dev/null +++ b/docs/examples-docs/zh-CN/theme.md @@ -0,0 +1,55 @@ +### 定制主题 + +`Vant`提供了一套默认主题,CSS 命名采用 BEM 的风格,方便使用者覆盖样式。如果你想完全替换主题色或者其他样式,可以使用下面的方法: + +### 方案一. PostCSS 插件 +在项目中直接引入组件对应的 postcss 源代码,并通过 postcss 插件 [postcss-theme-variables](https://www.npmjs.com/package/postcss-theme-variables) 替换颜色变量,步骤如下: + +```javascript +// 引入基础样式 +import 'vant/packages/vant-css/src/base.css'; + +// 引入组价对应的样式 +import 'vant/packages/vant-css/src/button.css'; +import 'vant/packages/vant-css/src/checkbox.css'; +``` + +接着在 postcss.config.js 中引入所需的 postcss 插件,并根据项目需求配置颜色变量,所有可用的颜色变量请参考 [配置文件](https://github.com/youzan/vant/blob/dev/packages/vant-css/src/common/var.css) + +```javascript +module.exports = { + plugins: [ + require('postcss-easy-import')({ + extensions: ['pcss', 'css'] + }), + require('postcss-theme-variables')({ + vars: { + red: '#F60', + gray: '#CCC', + blue: '#03A9F4' + }, + prefix: '$' + }), + require('precss')(), + require('postcss-calc')(), + require('autoprefixer')({ + browsers: ['Android >= 4.0', 'iOS >= 7'] + }) + ] +}; +``` + +### 方案二. 本地构建 +可以通过在本地构建 vant-css 的方式生成所需的主题 + +```bash +# 克隆仓库 +git clone git@github.com:youzan/vant.git +cd packages/vant-css +``` + +在本地 vant-css 仓库中,修改 src/common/var.css 中的颜色变量,然后执行以下构建命令,即可生成对应的样式文件 +```bash +npm run build +``` + diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index 9acf2c547..f7f81e9d3 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -35,6 +35,11 @@ module.exports = { title: '更新日志', noExample: true }, + { + path: '/theme', + title: '定制主题', + noExample: true + }, { path: '/demo', title: '示例页面', From e006f1402ec3f68d334cc838bd1a74bda82c5a0e Mon Sep 17 00:00:00 2001 From: Wis Date: Thu, 26 Oct 2017 15:20:35 +0800 Subject: [PATCH 25/49] [fix bug] pull refreash parent element scrollable error (#247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当下拉刷新元素的父级有可滚动元素的时候,下拉刷新不可用 --- packages/pull-refresh/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pull-refresh/index.vue b/packages/pull-refresh/index.vue index a543e3565..8840e8a66 100644 --- a/packages/pull-refresh/index.vue +++ b/packages/pull-refresh/index.vue @@ -28,6 +28,7 @@ @@ -48,8 +38,7 @@ Vue.component(DatetimePicker.name, DatetimePicker); :max-hour="maxHour" :min-date="minDate" :max-date="maxDate" - @change="handlePickerChange"> - +/> ``` ```javascript @@ -62,20 +51,14 @@ export default { maxDate: new Date(2019, 10, 1), currentDate: new Date(2018, 0, 1) }; - }, - - methods: { - handlePickerChange(picker) { - console.log(picker); - } } }; ``` ::: -#### 选择日期 +#### Date Picker -:::demo 选择日期 +:::demo Date Picker ```html - +/> ``` ::: -#### 选择时间 +#### Time Picker -:::demo 选择时间 +:::demo Time Picker ```html - +/> ``` ::: @@ -108,30 +89,17 @@ export default { | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| -| visibileColumnCount | 每一列可见备选元素的个数 | Number | 5 | - | -| type | 组件类型 | String | 'datetime' | 'datetime', 'date', 'time' | -| minDate | 可选的最小日期 | Date | 十年前的 1 月 1 日 | - | -| maxDate | 可选的最大日期 | Date | 十年后的 12 月 31 日 | - | -| minHour | 可选的最小小时 | Number | 0 | - | -| maxHour | 可选的最大小时 | Number | 23 | - | +| type | Picker type | `String` | 'datetime' | 'date', 'time' | +| minDate | Min date | `Date` | Ten years ago on January 1 | - | +| maxDate | Max date | `Date` | Ten years later on December 31 | - | +| minHour | Min hour | `Number` | `0` | - | +| maxHour | Max hour | `Number` | `23` | - | +| visibileColumnCount | Count of columns to show | `Number` | `5` | - | ### Event | Event | Description | Arguments | |-----------|-----------|-----------| -| change | 当值变化时触发的事件 | picker 实例 | -| confirm | 点击完成按钮时触发的事件 | 当前 value | -| cancel | 点击取消按钮时触发的事件 | - | - -### change事件 - -在`change`事件中,可以获取到`picker`实例,对`picker`进行相应的更新等操作: - -| 函数 | Description | -|-----------|-----------| -| getColumnValue(index) | 获取对应列中选中的值 | -| setColumnValue(index, value) | 设置对应列中选中的值 | -| getColumnValues(index) | 获取对应列中所有的备选值 | -| setColumnValues(index, values) | 设置对应列中所有的备选值 | -| getValues() | 获取所有列中被选中的值,返回一个数组 | -| setValues(values) | `values`为一个数组,设置所有列中被选中的值 | +| change | Triggered when value changed | picker: picker instance | +| confirm | Triggered when click confirm button | value: current value | +| cancel | Triggered when click cancel button | - | diff --git a/docs/examples-docs/en-US/dialog.md b/docs/examples-docs/en-US/dialog.md index f7a53e34a..97f8d5ac6 100644 --- a/docs/examples-docs/en-US/dialog.md +++ b/docs/examples-docs/en-US/dialog.md @@ -1,27 +1,31 @@ @@ -41,9 +41,14 @@ Vue.component(PullRefresh.name, PullRefresh); :::demo ```html - - -

刷新次数: {{ count }}

+ + +

Refresh Count: {{ count }}

``` @@ -60,7 +65,7 @@ export default { isLoading() { if (this.isLoading) { setTimeout(() => { - Toast('刷新成功'); + Toast('Refresh Success'); this.isLoading = false; this.count++; }, 500); @@ -75,19 +80,19 @@ export default { | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| -| v-model | 是否在加载中 | `Boolean` | - | - | -| pullingText | 下拉过程中顶部文案 | `String` | `下拉即可刷新...` | - | -| loosingText | 释放过程中顶部文案 | `String` | `释放即可刷新...` | - | -| loadingText | 加载过程中顶部文案 | `String` | `加载中...` | - | -| animationDuration | 动画时长 | `Number` | `300` | - | -| headHeight | 顶部内容高度 | `Number` | `50` | - | +| v-model | Loading status | `Boolean` | - | - | +| pullingText | Text to show when pulling | `String` | `下拉即可刷新...` | - | +| loosingText | Text to show when loosing | `String` | `释放即可刷新...` | - | +| loadingText | Text to show when loading | `String` | `加载中...` | - | +| animationDuration | Animation duration | `Number` | `300` | - | +| headHeight | Height of head | `Number` | `50` | - | ### Slot | name | Description | |-----------|-----------| -| - | 自定义内容 | -| normal | 非下拉状态时顶部内容 | -| pulling | 下拉过程中顶部内容 | -| loosing | 释放过程中顶部内容 | -| loading | 加载过程中顶部内容 | +| - | Default slot | +| normal | Content of head when at normal status | +| pulling | Content of head when at pulling | +| loosing | Content of head when at loosing | +| loading | Content of head when at loading | diff --git a/docs/examples-docs/zh-CN/actionsheet.md b/docs/examples-docs/zh-CN/actionsheet.md index c8aab1b84..7c8af18d4 100644 --- a/docs/examples-docs/zh-CN/actionsheet.md +++ b/docs/examples-docs/zh-CN/actionsheet.md @@ -8,24 +8,26 @@ margin-left: 15px; } - .title-actionsheet p { + p { padding: 20px; } } @@ -48,8 +38,7 @@ Vue.component(DatetimePicker.name, DatetimePicker); :max-hour="maxHour" :min-date="minDate" :max-date="maxDate" - @change="handlePickerChange"> - +/> ``` ```javascript @@ -62,12 +51,6 @@ export default { maxDate: new Date(2019, 10, 1), currentDate: new Date(2018, 0, 1) }; - }, - - methods: { - handlePickerChange(picker) { - console.log(picker); - } } }; ``` @@ -83,8 +66,7 @@ export default { :min-hour="minHour" :max-hour="maxHour" :min-date="minDate" - @change="handlePickerChange"> - +/> ``` ::: @@ -98,8 +80,7 @@ export default { :min-hour="minHour" :max-hour="maxHour" :min-date="minDate" - @change="handlePickerChange"> - +/> ``` ::: @@ -108,12 +89,12 @@ export default { | 参数 | 说明 | 类型 | 默认值 | 可选值 | |-----------|-----------|-----------|-------------|-------------| -| visibileColumnCount | 每一列可见备选元素的个数 | Number | 5 | - | -| type | 组件类型 | String | 'datetime' | 'datetime', 'date', 'time' | -| minDate | 可选的最小日期 | Date | 十年前的 1 月 1 日 | - | -| maxDate | 可选的最大日期 | Date | 十年后的 12 月 31 日 | - | -| minHour | 可选的最小小时 | Number | 0 | - | -| maxHour | 可选的最大小时 | Number | 23 | - | +| type | 组件类型 | `String` | 'datetime' | 'date', 'time' | +| minDate | 可选的最小日期 | `Date` | 十年前的 1 月 1 日 | - | +| maxDate | 可选的最大日期 | `Date` | 十年后的 12 月 31 日 | - | +| minHour | 可选的最小小时 | `Number` | `0` | - | +| maxHour | 可选的最大小时 | `Number` | `23` | - | +| visibileColumnCount | 每一列可见备选元素的个数 | `Number` | `5` | - | ### Event diff --git a/docs/examples-docs/zh-CN/picker.md b/docs/examples-docs/zh-CN/picker.md index 1b7d5e903..e02b85dad 100644 --- a/docs/examples-docs/zh-CN/picker.md +++ b/docs/examples-docs/zh-CN/picker.md @@ -93,9 +93,9 @@ export default { :::demo 带toolbar的Picker ```html Date: Thu, 26 Oct 2017 22:14:08 -0500 Subject: [PATCH 33/49] [Doc] change document site path to /zanui/vant (#262) * [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 --- README.md | 6 +++--- README.zh-CN.md | 6 +++--- build/webpack.config.prod.js | 2 +- docs/src/DocsApp.vue | 2 +- docs/src/examples.js | 2 +- docs/src/index.js | 4 ++-- package.json | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 422edb40d..cab9010b5 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Vue.use(Vant); ``` -See more in [Quickstart](https://www.youzanyun.com/zanui/vue#/en-US/component/quickstart). +See more in [Quickstart](https://www.youzanyun.com/zanui/vant#/en-US/component/quickstart). ## Contribution Please make sure to read the [Contributing Guide](./.github/CONTRIBUTING.md) before making a pull request. @@ -93,8 +93,8 @@ Please make sure to read the [Contributing Guide](./.github/CONTRIBUTING.md) bef Modern browsers and Android 4.0+, iOS 6+. ## Links -- [Documentation](https://www.youzanyun.com/zanui/vue) -- [Change log](https://www.youzanyun.com/zanui/vue#/en-US/component/changelog) +- [Documentation](https://www.youzanyun.com/zanui/vant) +- [Change log](https://www.youzanyun.com/zanui/vant#/en-US/component/changelog) - [React UI Zent](https://www.youzanyun.com/zanui/react) - [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) - [vant-demo](https://github.com/chenjiahan/vant-demo) diff --git a/README.zh-CN.md b/README.zh-CN.md index bb26664a1..cee4cfbf2 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -82,7 +82,7 @@ Vue.use(Vant); ``` -更多内容请参考 [快速上手](https://www.youzanyun.com/zanui/vue#/zh-CN/component/quickstart). +更多内容请参考 [快速上手](https://www.youzanyun.com/zanui/vant#/zh-CN/component/quickstart). ## 贡献代码 @@ -100,8 +100,8 @@ Vue.use(Vant); ![zanui_vue_mobile_qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) ## 链接 -- [详细文档](https://www.youzanyun.com/zanui/vue) -- [更新日志](https://www.youzanyun.com/zanui/vue#/en-US/component/changelog) +- [详细文档](https://www.youzanyun.com/zanui/vant) +- [更新日志](https://www.youzanyun.com/zanui/vant#/en-US/component/changelog) - [React 组件库 Zent](https://www.youzanyun.com/zanui/react) - [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) - [vant-demo](https://github.com/chenjiahan/vant-demo) diff --git a/build/webpack.config.prod.js b/build/webpack.config.prod.js index 669f10f37..972b0205f 100644 --- a/build/webpack.config.prod.js +++ b/build/webpack.config.prod.js @@ -6,7 +6,7 @@ const devConfig = require('./webpack.config.dev.js'); module.exports = merge(devConfig, { output: { path: path.join(__dirname, '../docs/dist'), - publicPath: 'https://b.yzcdn.cn/zanui/vue/', + publicPath: 'https://b.yzcdn.cn/zanui/vant/', filename: '[name].[hash:8].js', umdNamedDefine: true, chunkFilename: 'async_[name].[chunkhash:8].js' diff --git a/docs/src/DocsApp.vue b/docs/src/DocsApp.vue index b771c54f9..8dd8f8ddc 100644 --- a/docs/src/DocsApp.vue +++ b/docs/src/DocsApp.vue @@ -18,7 +18,7 @@ export default { } return { - simulators: [`/zanui/vue/examples${location.hash}`], + simulators: [`/zanui/vant/examples${location.hash}`], demoURL: '', lang: getLang() }; diff --git a/docs/src/examples.js b/docs/src/examples.js index 60b8e7d06..7bf0af320 100644 --- a/docs/src/examples.js +++ b/docs/src/examples.js @@ -18,7 +18,7 @@ Vue.use(VueRouter); const routesConfig = routes(true); const router = new VueRouter({ mode: 'hash', - base: '/zanui/vue/examples', + base: '/zanui/vant/examples', routes: routesConfig }); diff --git a/docs/src/index.js b/docs/src/index.js index 8eea7e664..740e18663 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -12,13 +12,13 @@ const routesConfig = routes(); const router = new VueRouter({ mode: 'hash', - base: '/zanui/vue/', + base: '/zanui/vant/', routes: routesConfig }); router.beforeEach((route, redirect, next) => { if (isMobile) { - window.location.replace('/zanui/vue/examples'); + window.location.replace('/zanui/vant/examples'); } document.title = route.meta.title || document.title; next(); diff --git a/package.json b/package.json index ae7d15279..32debe4e1 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build:style-entry": "VUE_ENV=server node build/bin/build-style-entry.js", "build:changelog": "sh build/bin/build-changelog.sh", "deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan && rimraf docs/dist", - "deploy:cdn": "superman cdn /zanui/vue docs/dist/*.js docs/dist/*.css && superman cdn /zanui/vue/async_en-US docs/dist/async_en-US/*.js && superman cdn /zanui/vue/async_zh-CN docs/dist/async_zh-CN/*.js", + "deploy:cdn": "superman cdn /zanui/vant docs/dist/*.js docs/dist/*.css && superman cdn /zanui/vant/async_en-US docs/dist/async_en-US/*.js && superman cdn /zanui/vant/async_zh-CN docs/dist/async_zh-CN/*.js", "deploy:docs": "rimraf docs/dist && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.config.prod.js", "dist": "node build/bin/build-lib.js", "clean": "rimraf lib && rimraf packages/*/lib", From ed43b21306612d40929b0e1a9fa86b2838a2bce4 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 27 Oct 2017 02:34:19 -0500 Subject: [PATCH 34/49] [bugfix] uploader style error (#265) * [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 --- build/webpack.config.dev.js | 4 ++-- docs/examples-docs/zh-CN/tab.md | 14 ++++++++------ packages/vant-css/src/uploader.css | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js index 71d194e41..1ecb1ab43 100644 --- a/build/webpack.config.dev.js +++ b/build/webpack.config.dev.js @@ -37,8 +37,8 @@ module.exports = { host: '0.0.0.0', historyApiFallback: { rewrites: [ - { from: /^\/zanui\/vue\/examples/, to: '/examples.html' }, - { from: /^\/zanui\/vue/, to: '/index.html' } + { from: /^\/zanui\/vant\/examples/, to: '/examples.html' }, + { from: /^\/zanui\/vant/, to: '/index.html' } ] }, stats: 'errors-only' diff --git a/docs/examples-docs/zh-CN/tab.md b/docs/examples-docs/zh-CN/tab.md index 3b12027d7..b3b05c4d0 100644 --- a/docs/examples-docs/zh-CN/tab.md +++ b/docs/examples-docs/zh-CN/tab.md @@ -24,6 +24,8 @@ diff --git a/test/unit/specs/cell.spec.js b/test/unit/specs/cell.spec.js index 268f979dc..58958141a 100644 --- a/test/unit/specs/cell.spec.js +++ b/test/unit/specs/cell.spec.js @@ -49,4 +49,46 @@ describe('Cell', () => { expect(eventStub.calledOnce).to.be.true; expect(eventStub.calledWith('click')).to.be.true; }); + + it('cell with url', () => { + wrapper = mount(Cell, { + propsData: { + url: '#test', + replace: false + } + }); + + wrapper.trigger('click'); + + expect(window.location.hash).to.equal('#test'); + window.location.hash = ''; + + const length = window.history.length; + wrapper.vm.replace = true; + wrapper.trigger('click'); + expect(window.location.hash).to.equal('#test'); + expect(window.history.length).to.equal(length); + window.location.hash = ''; + }); + + it('cell with to', done => { + wrapper = mount(Cell, { + propsData: { + to: '/test', + replace: false + } + }); + wrapper.vm.$router = { + push(path) { + wrapper.vm.replace = true; + wrapper.trigger('click'); + }, + replace(path) { + expect(path).to.equal('/test'); + done(); + } + }; + + wrapper.trigger('click'); + }); }); diff --git a/yarn.lock b/yarn.lock index 7853347d0..7f137511b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -59,8 +59,8 @@ acorn@^4.0.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" acorn@^5.0.0, acorn@^5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" + version "5.2.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" after@0.8.2: version "0.8.2" @@ -71,8 +71,8 @@ ajv-keywords@^1.0.0: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" ajv-keywords@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.0.tgz#a296e17f7bfae7c1ce4f7e0de53d29cb32162df0" + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" ajv@^4.11.2, ajv@^4.7.0, ajv@^4.9.1: version "4.11.8" @@ -82,13 +82,13 @@ ajv@^4.11.2, ajv@^4.7.0, ajv@^4.9.1: json-stable-stringify "^1.0.1" ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5: - version "5.2.3" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.3.tgz#c06f598778c44c6b161abafe3466b81ad1814ed2" + version "5.3.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda" dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" - json-stable-stringify "^1.0.1" align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" @@ -1134,11 +1134,11 @@ browserslist@^1.3.6, browserslist@^1.5.2, browserslist@^1.7.6: electron-to-chromium "^1.2.7" browserslist@^2.1.2, browserslist@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.5.1.tgz#68e4bc536bbcc6086d62843a2ffccea8396821c6" + version "2.6.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.6.1.tgz#cc65a05ad6131ebda26f076f2822ba1bc826376b" dependencies: - caniuse-lite "^1.0.30000744" - electron-to-chromium "^1.3.24" + caniuse-lite "^1.0.30000755" + electron-to-chromium "^1.3.27" buffer-indexof@^1.0.0: version "1.1.1" @@ -1226,20 +1226,12 @@ caniuse-api@^1.5.2: lodash.uniq "^4.5.0" caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: - version "1.0.30000748" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000748.tgz#785d9edfcd645bf795c6ff3ced33c45d580c48a0" + version "1.0.30000756" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000756.tgz#e938a6b991630f30d2263dd3458beb65d362268b" -caniuse-lite@^1.0.30000744: - version "1.0.30000748" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000748.tgz#44c8d6da52ad65a5d7b9dca4efebd0bdd982ba09" - -caniuse-lite@^1.0.30000748: - version "1.0.30000749" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000749.tgz#2ff382865aead8cca35dacfbab04f58effa4c01c" - -caseless@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" +caniuse-lite@^1.0.30000748, caniuse-lite@^1.0.30000755: + version "1.0.30000756" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000756.tgz#3da701c1521b9fab87004c6de7c97fa47dbeaad2" caseless@~0.12.0: version "0.12.0" @@ -1284,8 +1276,8 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: supports-color "^2.0.0" chalk@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.2.0.tgz#477b3bf2f9b8fd5ca9e429747e37f724ee7af240" + version "2.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" dependencies: ansi-styles "^3.1.0" escape-string-regexp "^1.0.5" @@ -1433,12 +1425,12 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -codecov@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/codecov/-/codecov-2.3.1.tgz#7dda945cd58a1f6081025b5b03ee01a2ef20f86e" +codecov@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.0.0.tgz#c273b8c4f12945723e8dc9d25803d89343e5f28e" dependencies: argv "0.0.2" - request "2.77.0" + request "2.81.0" urlgrey "0.4.4" color-convert@^1.3.0, color-convert@^1.9.0: @@ -1526,10 +1518,10 @@ component-inherit@0.0.3: resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143" compressible@~2.0.11: - version "2.0.11" - resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.11.tgz#16718a75de283ed8e604041625a2064586797d8a" + version "2.0.12" + resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.12.tgz#c59a5c99db76767e9876500e271ef63b3493bd66" dependencies: - mime-db ">= 1.29.0 < 2" + mime-db ">= 1.30.0 < 2" compression@^1.5.2: version "1.7.1" @@ -1663,9 +1655,9 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-env@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.0.tgz#1f12d6b3777d5847dcf9cf39fbee3c6a76dd5058" +cross-env@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.1.tgz#b6d8ab97f304c0f71dae7277b75fe424c08dfa74" dependencies: cross-spawn "^5.1.0" is-windows "^1.0.0" @@ -2214,9 +2206,9 @@ ejs@^2.5.6: version "2.5.7" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" -electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.24: - version "1.3.26" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.26.tgz#996427294861a74d9c7c82b9260ea301e8c02d66" +electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.27: + version "1.3.27" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" elliptic@^6.0.0: version "6.4.0" @@ -2800,6 +2792,10 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -3517,15 +3513,6 @@ har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" -har-validator@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" - dependencies: - chalk "^1.1.1" - commander "^2.9.0" - is-my-json-valid "^2.12.4" - pinkie-promise "^2.0.0" - har-validator@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" @@ -3823,8 +3810,8 @@ ieee754@^1.1.4: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" ignore@^3.2.0: - version "3.3.5" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.5.tgz#c4e715455f6073a8d7e5dae72d2fc9d71663dba6" + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" import-local@^0.1.1: version "0.1.1" @@ -3942,8 +3929,8 @@ is-binary-path@^1.0.0: binary-extensions "^1.0.0" is-buffer@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" is-builtin-module@^1.0.0: version "1.0.0" @@ -4019,7 +4006,7 @@ is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" -is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: +is-my-json-valid@^2.10.0: version "2.16.1" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz#5a846777e2c2620d1e69104e5d3a03b1f6088f11" dependencies: @@ -4388,8 +4375,8 @@ karma-phantomjs-launcher@^1.0.4: phantomjs-prebuilt "^2.1.7" karma-sinon-chai@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/karma-sinon-chai/-/karma-sinon-chai-1.3.2.tgz#ea4d97b16433e64813aaddddded7f7bb4338215e" + version "1.3.3" + resolved "https://registry.yarnpkg.com/karma-sinon-chai/-/karma-sinon-chai-1.3.3.tgz#a597e5b4a1369fe7b3d7d76c09ed2061a38e747f" dependencies: lolex "^1.6.0" @@ -4908,10 +4895,10 @@ macaddress@^0.2.8: resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12" make-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.0.0.tgz#97a011751e91dd87cfadef58832ebb04936de978" + version "1.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.1.0.tgz#19b4369fe48c116f53c2af95ad102c0e39e85d51" dependencies: - pify "^2.3.0" + pify "^3.0.0" map-cache@^0.2.0: version "0.2.2" @@ -5033,7 +5020,11 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" -"mime-db@>= 1.29.0 < 2", mime-db@~1.30.0: +"mime-db@>= 1.30.0 < 2": + version "1.31.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.31.0.tgz#a49cd8f3ebf3ed1a482b60561d9105ad40ca74cb" + +mime-db@~1.30.0: version "1.30.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" @@ -5284,10 +5275,6 @@ node-source-walk@^3.0.0, node-source-walk@^3.2.0, node-source-walk@^3.3.0: dependencies: babylon "^6.17.0" -node-uuid@~1.4.7: - version "1.4.8" - resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.8.tgz#b040eb0923968afabf8d32fb1f17f1167fdab907" - node-watch@^0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/node-watch/-/node-watch-0.5.5.tgz#34865ba8bc6861ab086acdcc3403e40ed55c3274" @@ -6040,11 +6027,11 @@ postcss-minify-selectors@^2.0.4: postcss-selector-parser "^2.0.0" postcss-mixins@^6.0.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/postcss-mixins/-/postcss-mixins-6.1.1.tgz#d77b9cfeab082d9674770e463757657ff7274d4e" + version "6.2.0" + resolved "https://registry.yarnpkg.com/postcss-mixins/-/postcss-mixins-6.2.0.tgz#fa9d2c2166b2ae7745956c727ab9dd2de4b96a40" dependencies: globby "^6.1.0" - postcss "^6.0.12" + postcss "^6.0.13" postcss-js "^1.0.1" postcss-simple-vars "^4.1.0" sugarss "^1.0.0" @@ -6213,7 +6200,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.11, postcss@^6.0.12, postcss@^6.0.13, postcss@^6.0.3, postcss@^6.0.8, postcss@^6.0.9: +postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.10, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.3, postcss@^6.0.8, postcss@^6.0.9: version "6.0.13" resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.13.tgz#b9ecab4ee00c89db3ec931145bd9590bbf3f125f" dependencies: @@ -6369,10 +6356,6 @@ qs@6.5.1, qs@~6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" -qs@~6.3.0: - version "6.3.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.2.tgz#e75bd5f6e268122a2a0e0bda630b2550c166502c" - qs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" @@ -6659,31 +6642,6 @@ request-progress@~2.0.1: dependencies: throttleit "^1.0.0" -request@2.77.0: - version "2.77.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.77.0.tgz#2b00d82030ededcc97089ffa5d8810a9c2aa314b" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.11.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~2.0.6" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - node-uuid "~1.4.7" - oauth-sign "~0.8.1" - qs "~6.3.0" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "~0.4.1" - request@2.81.0, request@~2.81.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" @@ -6803,8 +6761,8 @@ resolve@1.1.x: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" resolve@^1.1.6, resolve@^1.1.7, resolve@^1.2.0, resolve@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: path-parse "^1.0.5" @@ -7034,8 +6992,8 @@ sntp@1.x.x: hoek "2.x.x" sntp@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.0.2.tgz#5064110f0af85f7cfdb7d6b67a40028ce52b4b2b" + version "2.1.0" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" dependencies: hoek "4.x.x" @@ -7210,7 +7168,11 @@ stackframe@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.0.4.tgz#357b24a992f9427cba6b545d96a14ed2cbca187b" -"statuses@>= 1.3.1 < 2", statuses@~1.3.1: +"statuses@>= 1.3.1 < 2": + version "1.4.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" + +statuses@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" @@ -7410,8 +7372,8 @@ tapable@^0.2.5, tapable@^0.2.7: resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" tar-pack@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984" + version "3.4.1" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" dependencies: debug "^2.2.0" fstream "^1.0.10" @@ -7572,10 +7534,6 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tunnel-agent@~0.4.1: - version "0.4.3" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" - tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" @@ -7625,8 +7583,8 @@ uc.micro@^1.0.1, uc.micro@^1.0.3: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.3.tgz#7ed50d5e0f9a9fb0a573379259f2a77458d50192" uglify-js@3.1.x: - version "3.1.4" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.4.tgz#8e1efa1244b207588e525c9c1835a33458b90aee" + version "3.1.6" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.6.tgz#918832602036e95d2318e11f27ee8461a8592c5d" dependencies: commander "~2.11.0" source-map "~0.6.1" From 422e4db118f8ed42fe4295506201c8810e16fa21 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 30 Oct 2017 06:52:27 -0500 Subject: [PATCH 36/49] [bugfix] Tabbar cann't display info when use icon slot (#269) * [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 --- packages/tabbar-item/index.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/tabbar-item/index.vue b/packages/tabbar-item/index.vue index 7b77393bd..122c3062f 100644 --- a/packages/tabbar-item/index.vue +++ b/packages/tabbar-item/index.vue @@ -2,10 +2,9 @@
- -
{{ info }}
-
+
+
{{ info }}
From 8e1a830ced515d132a810db8ea93d40fbdf70353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 30 Oct 2017 19:55:18 +0800 Subject: [PATCH 37/49] [build] 0.10.5 --- packages/index.js | 2 +- packages/vant-css/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/index.js b/packages/index.js index c14cdd0a2..c6a74b238 100644 --- a/packages/index.js +++ b/packages/index.js @@ -59,7 +59,7 @@ import TreeSelect from './tree-select'; import Uploader from './uploader'; import Waterfall from './waterfall'; -const version = '0.10.4'; +const version = '0.10.5'; const components = [ Actionsheet, AddressEdit, diff --git a/packages/vant-css/package.json b/packages/vant-css/package.json index 1b1f9bbe0..f6bc6f821 100644 --- a/packages/vant-css/package.json +++ b/packages/vant-css/package.json @@ -1,6 +1,6 @@ { "name": "vant-css", - "version": "0.10.4", + "version": "0.10.5", "description": "vant css.", "main": "lib/index.css", "style": "lib/index.css", From 8cd0fc813556d50703e3ccc091c053e936f6c306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 30 Oct 2017 19:55:19 +0800 Subject: [PATCH 38/49] [release] 0.10.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dca4c5224..8d625683b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.10.4", + "version": "0.10.5", "description": "有赞vue wap组件库", "main": "lib/vant.js", "style": "lib/vant-css/index.css", From 33e2e99e78e46d1b924c1e3f571b1d514b317ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 30 Oct 2017 20:47:44 +0800 Subject: [PATCH 39/49] [changelog] 0.10.5 --- docs/examples-docs/en-US/changelog.md | 10 +++++++++ .../zh-CN/changelog-generated.md | 22 +++++++++++++++++++ docs/examples-docs/zh-CN/changelog.md | 10 +++++++++ 3 files changed, 42 insertions(+) diff --git a/docs/examples-docs/en-US/changelog.md b/docs/examples-docs/en-US/changelog.md index 990ab710e..9ab040d51 100644 --- a/docs/examples-docs/en-US/changelog.md +++ b/docs/examples-docs/en-US/changelog.md @@ -1,5 +1,15 @@ ## Changelog +### [0.10.5](https://github.com/youzan/vant/tree/v0.10.5) +`2017-10-30` + +**Improvements** +- Cell support vue-router target route [\#268](https://github.com/youzan/vant/pull/268) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** +- fix Tabbar info display when use icon slot [\#269](https://github.com/youzan/vant/pull/269) [@chenjiahan](https://github.com/chenjiahan) +- fix Uploader input type [\#265](https://github.com/youzan/vant/pull/265) [@chenjiahan](https://github.com/chenjiahan) + ### [0.10.4](https://github.com/youzan/vant/tree/v0.10.4) `2017-10-26` diff --git a/docs/examples-docs/zh-CN/changelog-generated.md b/docs/examples-docs/zh-CN/changelog-generated.md index 48caeefb6..4c7232798 100644 --- a/docs/examples-docs/zh-CN/changelog-generated.md +++ b/docs/examples-docs/zh-CN/changelog-generated.md @@ -1,5 +1,27 @@ ## 更新日志 +## [v0.10.5](https://github.com/youzan/vant/tree/v0.10.5) (2017-10-30) +[Full Changelog](https://github.com/youzan/vant/compare/v0.10.4...v0.10.5) + +**Breaking changes** + +- Please give an english translation for the API [\#156](https://github.com/youzan/vant/issues/156) +- 以前的产品 橱窗组件怎么没有了? [\#119](https://github.com/youzan/vant/issues/119) + +**Issue** + +- van-col里嵌套动态img问题 [\#261](https://github.com/youzan/vant/issues/261) +- 这是一条咨询, 非技术issues [\#259](https://github.com/youzan/vant/issues/259) +- 图标库不方便管理,建议开源字体图标库 [\#255](https://github.com/youzan/vant/issues/255) + +**Improvements** + +- \[bugfix\] Tabbar cann't display info when use icon slot [\#269](https://github.com/youzan/vant/pull/269) ([chenjiahan](https://github.com/chenjiahan)) +- \[new feature\] Cell support vue-router target route [\#268](https://github.com/youzan/vant/pull/268) ([chenjiahan](https://github.com/chenjiahan)) +- \[bugfix\] uploader style error [\#265](https://github.com/youzan/vant/pull/265) ([chenjiahan](https://github.com/chenjiahan)) +- \[Doc\] change document site path to /zanui/vant [\#262](https://github.com/youzan/vant/pull/262) ([chenjiahan](https://github.com/chenjiahan)) +- \[Doc\] english document of all action components [\#260](https://github.com/youzan/vant/pull/260) ([chenjiahan](https://github.com/chenjiahan)) + ## [v0.10.4](https://github.com/youzan/vant/tree/v0.10.4) (2017-10-26) [Full Changelog](https://github.com/youzan/vant/compare/v0.10.3...v0.10.4) diff --git a/docs/examples-docs/zh-CN/changelog.md b/docs/examples-docs/zh-CN/changelog.md index 92d925e4a..5b0e7e658 100644 --- a/docs/examples-docs/zh-CN/changelog.md +++ b/docs/examples-docs/zh-CN/changelog.md @@ -1,5 +1,15 @@ ## 更新日志 +### [0.10.5](https://github.com/youzan/vant/tree/v0.10.5) +`2017-10-30` + +**Improvements** +- Cell 支持 vue-router 路由跳转 [\#268](https://github.com/youzan/vant/pull/268) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** +- 修复 Tabbar 使用 icon slot 时 info prop 失效的问题 [\#269](https://github.com/youzan/vant/pull/269) [@chenjiahan](https://github.com/chenjiahan) +- 修复 Uploader input 类型错误 [\#265](https://github.com/youzan/vant/pull/265) [@chenjiahan](https://github.com/chenjiahan) + ### [0.10.4](https://github.com/youzan/vant/tree/v0.10.4) `2017-10-26` From d97269084b71e692d80baae258fa6e719e0ef06d Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 31 Oct 2017 20:53:04 -0500 Subject: [PATCH 40/49] [Doc] update document site title (#274) * [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 --- .eslintrc.js | 1 - README.md | 4 ++-- README.zh-CN.md | 4 ++-- docs/src/doc.config.js | 4 ++-- docs/src/index.tpl | 2 +- packages/toast/toast.vue | 4 ++-- packages/vant-css/README.md | 1 - 7 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 packages/vant-css/README.md diff --git a/.eslintrc.js b/.eslintrc.js index c01c74327..27cd432b1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,7 +19,6 @@ module.exports = { globals: { expect: true, sinon: true, - zanui: true, document: false, navigator: false, window: false, diff --git a/README.md b/README.md index cab9010b5..81a93c082 100644 --- a/README.md +++ b/README.md @@ -95,14 +95,14 @@ Modern browsers and Android 4.0+, iOS 6+. ## Links - [Documentation](https://www.youzanyun.com/zanui/vant) - [Change log](https://www.youzanyun.com/zanui/vant#/en-US/component/changelog) -- [React UI Zent](https://www.youzanyun.com/zanui/react) +- [React UI Zent](https://www.youzanyun.com/zanui/zent) - [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) - [vant-demo](https://github.com/chenjiahan/vant-demo) ## Preview You can scan the following QR code to access the demo: -![zanui_vue_mobile_qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) +![qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) ## LICENSE diff --git a/README.zh-CN.md b/README.zh-CN.md index cee4cfbf2..8a8a31566 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -97,12 +97,12 @@ Vue.use(Vant); 可以手机扫码以下二维码访问手机端demo: -![zanui_vue_mobile_qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) +![qrcode](https://img.yzcdn.cn/v2/image/youzanyun/zanui/pc/zanui_vue_mobile_preview_03.png) ## 链接 - [详细文档](https://www.youzanyun.com/zanui/vant) - [更新日志](https://www.youzanyun.com/zanui/vant#/en-US/component/changelog) -- [React 组件库 Zent](https://www.youzanyun.com/zanui/react) +- [React 组件库 Zent](https://www.youzanyun.com/zanui/zent) - [vue-cli-template-vant](https://github.com/youzan/vue-cli-template-vant) - [vant-demo](https://github.com/chenjiahan/vant-demo) diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index f7f81e9d3..d27ad12df 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -8,7 +8,7 @@ module.exports = { footer: { github: 'https://github.com/youzan/vant', nav: { - 'React 组件库': 'https://www.youzanyun.com/zanui/react', + 'React 组件库': 'https://www.youzanyun.com/zanui/zent', 小程序组件库: 'https://github.com/youzan/zanui-weapp', 意见反馈: 'https://github.com/youzan/vant/issues', 开发指南: 'https://github.com/youzan/vant/blob/dev/.github/CONTRIBUTING.zh-CN.md', @@ -275,7 +275,7 @@ module.exports = { footer: { github: 'https://github.com/youzan/vant', nav: { - 'React UI': 'https://www.youzanyun.com/zanui/react', + 'React UI': 'https://www.youzanyun.com/zanui/zent', 'Weapp UI': 'https://github.com/youzan/zanui-weapp', Feedback: 'https://github.com/youzan/vant/issues', Contribute: diff --git a/docs/src/index.tpl b/docs/src/index.tpl index 5266d0fbb..90814eb00 100644 --- a/docs/src/index.tpl +++ b/docs/src/index.tpl @@ -4,7 +4,7 @@ - ZanUI - 移动端 + Vant - 有赞移动端 Vue 组件库 diff --git a/packages/toast/toast.vue b/packages/toast/toast.vue index 82d392678..967e45804 100644 --- a/packages/toast/toast.vue +++ b/packages/toast/toast.vue @@ -3,8 +3,8 @@
-
{{ message }}
-
+
{{ message }}
+
@@ -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]; From 74a3eea203a600d96760f12505d3b45e31b0fc77 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 3 Nov 2017 04:50:58 -0500 Subject: [PATCH 42/49] [new feature] Swipe add 'initialSwipe' prop (#279) * [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 * [new feature] Swipe add 'initialSwipe' prop --- docs/examples-docs/en-US/swipe.md | 1 + docs/examples-docs/zh-CN/swipe.md | 3 ++- packages/swipe/index.vue | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/examples-docs/en-US/swipe.md b/docs/examples-docs/en-US/swipe.md index 57fa76f6d..5c2287909 100644 --- a/docs/examples-docs/en-US/swipe.md +++ b/docs/examples-docs/en-US/swipe.md @@ -72,6 +72,7 @@ export default { | autoplay | Autoplay interval (ms) | `Number` | - | - | | duration | Animation duration (ms) | `Number` | `500` | - | | showIndicators | Whether to show indocators | `Boolean` | `true` | - | +| initialSwipe | Index of initial swipe, start from 0 | `Number` | `0` | - | ### Event diff --git a/docs/examples-docs/zh-CN/swipe.md b/docs/examples-docs/zh-CN/swipe.md index 26d014a68..5470707b8 100644 --- a/docs/examples-docs/zh-CN/swipe.md +++ b/docs/examples-docs/zh-CN/swipe.md @@ -80,7 +80,7 @@ Vue.component(SwipeItem.name, SwipeItem); :::demo 图片懒加载 ```html - + @@ -108,6 +108,7 @@ export default { | autoplay | 自动轮播间隔,单位为 ms | `Number` | - | - | | duration | 动画时长,单位为 ms | `Number` | `500` | - | | showIndicators | 是否显示指示器 | `Boolean` | `true` | - | +| initialSwipe | 初始位置,从 0 开始算 | `Number` | `0` | - | ### 事件 diff --git a/packages/swipe/index.vue b/packages/swipe/index.vue index ca9e427d1..f0af6ec74 100644 --- a/packages/swipe/index.vue +++ b/packages/swipe/index.vue @@ -30,6 +30,10 @@ export default { props: { autoplay: Number, + initialSwipe: { + type: Number, + default: 0 + }, showIndicators: { type: Boolean, default: true @@ -92,9 +96,9 @@ export default { // reset offset when children changes clearTimeout(this.timer); this.width = this.$el.getBoundingClientRect().width; - this.active = 0; + this.active = this.initialSwipe; this.currentDuration = 0; - this.offset = this.count > 1 ? -this.width : 0; + this.offset = this.count > 1 ? -this.width * (this.active + 1) : 0; this.swipes.forEach(swipe => { swipe.offset = 0; }); From 3f7985ed2e600f612108601bab1cb9ff9e3b6d90 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 3 Nov 2017 07:13:18 -0500 Subject: [PATCH 43/49] [bugfix] NoticeBar text disappeared when page back (#280) * [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 * [new feature] Swipe add 'initialSwipe' prop * [bugfix] NoticeBar text disappeared when page back --- docs/examples-docs/zh-CN/notice-bar.md | 1 + packages/notice-bar/index.vue | 34 ++++++++++++++------------ packages/vant-css/src/notice-bar.css | 21 ++++++++++++++-- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/docs/examples-docs/zh-CN/notice-bar.md b/docs/examples-docs/zh-CN/notice-bar.md index b41b06cee..4eaeccbfb 100644 --- a/docs/examples-docs/zh-CN/notice-bar.md +++ b/docs/examples-docs/zh-CN/notice-bar.md @@ -21,6 +21,7 @@ Vue.component(NoticeBar.name, NoticeBar); :::demo 基础用法 ```html +
-
+
{{ text }}
@@ -55,11 +60,12 @@ export default { data() { return { + wrapWidth: 0, firstRound: true, duration: 0, offsetWidth: 0, showNoticeBar: true, - diableTransition: false + animationClass: '' }; }, @@ -75,9 +81,9 @@ export default { }, contentStyle() { return { - transform: `translate3d(${-this.offsetWidth}px, 0, 0)`, - transitionDelay: (this.firstRound ? this.delay : 0) + 's', - transitionDuration: this.duration + 's' + paddingLeft: this.firstRound ? 0 : this.wrapWidth + 'px', + animationDelay: (this.firstRound ? this.delay : 0) + 's', + animationDuration: this.duration + 's' }; } }, @@ -88,7 +94,8 @@ export default { if (this.scrollable && offsetWidth > wrapWidth) { this.wrapWidth = wrapWidth; this.offsetWidth = offsetWidth; - this.duration = (offsetWidth + wrapWidth) / this.speed; + this.duration = offsetWidth / this.speed; + this.animationClass = 'van-notice-bar__play'; } }, @@ -96,17 +103,12 @@ export default { onClickIcon() { this.showNoticeBar = this.mode !== 'closeable'; }, - onTransitionEnd() { - const { offsetWidth, wrapWidth } = this; + onAnimationEnd() { this.firstRound = false; - this.duration = 0; - this.offsetWidth = -this.wrapWidth; - - // wait for vue render && dom update - setTimeout(() => { - this.duration = (offsetWidth + 2 * wrapWidth) / this.speed; - this.offsetWidth = offsetWidth; - }, 50); + this.$nextTick(() => { + this.duration = (this.offsetWidth + this.wrapWidth) / this.speed; + this.animationClass = 'van-notice-bar__play--infinite'; + }); } } }; diff --git a/packages/vant-css/src/notice-bar.css b/packages/vant-css/src/notice-bar.css index 8d0da9a7e..35436facb 100644 --- a/packages/vant-css/src/notice-bar.css +++ b/packages/vant-css/src/notice-bar.css @@ -32,7 +32,6 @@ position: absolute; font-size: 15px; line-height: 1; - cursor: pointer; } &__content-wrap { @@ -45,6 +44,24 @@ &__content { position: absolute; white-space: nowrap; - transition: all linear; + } + + &__play { + animation: van-notice-bar-play linear both; + } + + &__play--infinite { + animation: van-notice-bar-play-infinite linear infinite both; } } + +/** + * Declare two same keyframes + * In case that some mobile browsers can continue animation when className changed + */ +@keyframes van-notice-bar-play { + to { transform: translate3d(-100%, 0, 0) } +} +@keyframes van-notice-bar-play-infinite { + to { transform: translate3d(-100%, 0, 0) } +} From 616238b9d4895e1eeba6ee609ce5a48ccecb9c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=95=8F?= Date: Mon, 6 Nov 2017 00:20:31 -0600 Subject: [PATCH 44/49] [bug fix]: tabs dynamic generate bug (#284) --- packages/tab/index.vue | 13 +++++++++ packages/tabs/index.vue | 61 +++++++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 23 deletions(-) diff --git a/packages/tab/index.vue b/packages/tab/index.vue index 65933ef2e..2b195283e 100644 --- a/packages/tab/index.vue +++ b/packages/tab/index.vue @@ -47,6 +47,19 @@ export default { index }); } + }, + + destroyed() { + const key = this.key; + const tabs = this.parentGroup.tabs; + + for (let i = 0; i < tabs.length; i++) { + /* istanbul ignore else */ + if (tabs[i].index === key) { + this.parentGroup.tabs.splice(i, 1); + return; + } + } } }; diff --git a/packages/tabs/index.vue b/packages/tabs/index.vue index 35801c65d..4b4e7fbbf 100644 --- a/packages/tabs/index.vue +++ b/packages/tabs/index.vue @@ -72,9 +72,10 @@ data() { return { tabs: [], - isReady: false, curActive: +this.active, - isSwiping: false + isSwiping: false, + isInitEvents: false, + navBarStyle: {} }; }, @@ -84,31 +85,27 @@ }, curActive() { + this.setNavBarStyle(); /* istanbul ignore else */ if (this.tabs.length > this.swipeThreshold) { this.doOnValueChange(); } + }, + + tabs(val) { + this.$nextTick(() => { + this.setNavBarStyle(); + if (val.length > this.swipeThreshold) { + this.initEvents(); + this.doOnValueChange(); + } else { + this.isInitEvents = false; + } + }); } }, computed: { - /** - * `type`为`line`时,tab下方的横线的样式 - */ - navBarStyle() { - if (!this.isReady || this.type !== 'line' || !this.$refs.tabkey) return; - - const tabKey = this.curActive; - const elem = this.$refs.tabkey[tabKey]; - const offsetWidth = `${elem.offsetWidth || 0}px`; - const offsetLeft = `${elem.offsetLeft || 0}px`; - - return { - width: offsetWidth, - transform: `translate3d(${offsetLeft}, 0, 0)`, - transitionDuration: `${this.duration}s` - }; - }, swipeWidth() { return this.$refs.swipe && this.$refs.swipe.getBoundingClientRect().width; }, @@ -127,17 +124,34 @@ mounted() { // 页面载入完成 this.$nextTick(() => { - // 可以开始触发在computed中关于nav-bar的css动画 - this.isReady = true; - this.initEvents(); + this.setNavBarStyle(); if (this.tabs.length > this.swipeThreshold) { + this.initEvents(); this.doOnValueChange(); } }); }, methods: { + /** + * `type`为`line`时,tab下方的横线的样式 + */ + setNavBarStyle() { + if (this.type !== 'line' || !this.$refs.tabkey) return {}; + + const tabKey = this.curActive; + const elem = this.$refs.tabkey[tabKey]; + const offsetWidth = `${elem.offsetWidth || 0}px`; + const offsetLeft = `${elem.offsetLeft || 0}px`; + + this.navBarStyle = { + width: offsetWidth, + transform: `translate3d(${offsetLeft}, 0, 0)`, + transitionDuration: `${this.duration}s` + }; + }, + handleTabClick(index) { if (this.tabs[index].disabled) { this.$emit('disabled', index); @@ -169,8 +183,9 @@ initEvents() { const el = this.$refs.swipe; - if (!el) return; + if (!el || this.isInitEvents) return; + this.isInitEvents = true; let swipeState = {}; swipe(el, { From bd7ee51f346a11fd7225ddf7494563ff6db2842f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 6 Nov 2017 20:33:59 +0800 Subject: [PATCH 45/49] [build] 0.10.6 --- packages/index.js | 2 +- packages/vant-css/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/index.js b/packages/index.js index c6a74b238..3c27bcae4 100644 --- a/packages/index.js +++ b/packages/index.js @@ -59,7 +59,7 @@ import TreeSelect from './tree-select'; import Uploader from './uploader'; import Waterfall from './waterfall'; -const version = '0.10.5'; +const version = '0.10.6'; const components = [ Actionsheet, AddressEdit, diff --git a/packages/vant-css/package.json b/packages/vant-css/package.json index f6bc6f821..1828c02a2 100644 --- a/packages/vant-css/package.json +++ b/packages/vant-css/package.json @@ -1,6 +1,6 @@ { "name": "vant-css", - "version": "0.10.5", + "version": "0.10.6", "description": "vant css.", "main": "lib/index.css", "style": "lib/index.css", From 8e92d37c806628e4379b091cdaa8f22f512cef28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 6 Nov 2017 20:34:00 +0800 Subject: [PATCH 46/49] [release] 0.10.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d625683b..d9d2a0098 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.10.5", + "version": "0.10.6", "description": "有赞vue wap组件库", "main": "lib/vant.js", "style": "lib/vant-css/index.css", From 6984f9db556e4276e32cf009561f9ae56112a134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 6 Nov 2017 20:41:55 +0800 Subject: [PATCH 47/49] [changelog] 0.10.6 --- docs/examples-docs/en-US/changelog.md | 11 ++++++++ .../zh-CN/changelog-generated.md | 28 +++++++++++++++++++ docs/examples-docs/zh-CN/changelog.md | 11 ++++++++ 3 files changed, 50 insertions(+) diff --git a/docs/examples-docs/en-US/changelog.md b/docs/examples-docs/en-US/changelog.md index 9ab040d51..7400d1527 100644 --- a/docs/examples-docs/en-US/changelog.md +++ b/docs/examples-docs/en-US/changelog.md @@ -1,5 +1,16 @@ ## Changelog +### [0.10.6](https://github.com/youzan/vant/tree/v0.10.6) +`2017-11-06` + +**Improvements** +- add Swipe initialSwipe prop [\#279](https://github.com/youzan/vant/pull/279) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** +- fix Dialog button text not reset when showed [\#278](https://github.com/youzan/vant/pull/278) [@chenjiahan](https://github.com/chenjiahan) +- fix Tab dynamic generate bug [\#284](https://github.com/youzan/vant/pull/284) [@cookfront](https://github.com/cookfront) +- fix NoticeBar text disappeared when page back [\#280](https://github.com/youzan/vant/pull/280) [@chenjiahan](https://github.com/chenjiahan) + ### [0.10.5](https://github.com/youzan/vant/tree/v0.10.5) `2017-10-30` diff --git a/docs/examples-docs/zh-CN/changelog-generated.md b/docs/examples-docs/zh-CN/changelog-generated.md index 4c7232798..889e1e933 100644 --- a/docs/examples-docs/zh-CN/changelog-generated.md +++ b/docs/examples-docs/zh-CN/changelog-generated.md @@ -1,5 +1,33 @@ ## 更新日志 +## [v0.10.6](https://github.com/youzan/vant/tree/v0.10.6) (2017-11-06) +[Full Changelog](https://github.com/youzan/vant/compare/v0.10.5...v0.10.6) + +**Bug Fixes** + +- tabbar自定义的情况下 无法生成info 是否考虑添加这个功能 [\#249](https://github.com/youzan/vant/issues/249) + +**Issue** + +- waterfall滚动到底部时无限触发加载 [\#283](https://github.com/youzan/vant/issues/283) +- swipe [\#282](https://github.com/youzan/vant/issues/282) +- waterfall瀑布流拉到最底之后无限触发事件 [\#281](https://github.com/youzan/vant/issues/281) +- Card点击事件无法触发 [\#276](https://github.com/youzan/vant/issues/276) +- Vant 下载 [\#275](https://github.com/youzan/vant/issues/275) +- 使用steps步骤条出现最后一个离得很远的问题 [\#273](https://github.com/youzan/vant/issues/273) +- 请问有DEMO首页的手风琴组件吗? [\#272](https://github.com/youzan/vant/issues/272) +- van-swipe组件添加了一个class就无法触摸滚动了 [\#270](https://github.com/youzan/vant/issues/270) +- Cell的url 只支持 mode: history的形式 [\#266](https://github.com/youzan/vant/issues/266) +- tabs组件文档有误 [\#264](https://github.com/youzan/vant/issues/264) + +**Improvements** + +- \[bug fix\]: tabs dynamic generate bug [\#284](https://github.com/youzan/vant/pull/284) ([cookfront](https://github.com/cookfront)) +- \[bugfix\] NoticeBar text disappeared when page back [\#280](https://github.com/youzan/vant/pull/280) ([chenjiahan](https://github.com/chenjiahan)) +- \[new feature\] Swipe add 'initialSwipe' prop [\#279](https://github.com/youzan/vant/pull/279) ([chenjiahan](https://github.com/chenjiahan)) +- \[bugfix\] Dialog should reset button text when showed [\#278](https://github.com/youzan/vant/pull/278) ([chenjiahan](https://github.com/chenjiahan)) +- \[Doc\] update document site title [\#274](https://github.com/youzan/vant/pull/274) ([chenjiahan](https://github.com/chenjiahan)) + ## [v0.10.5](https://github.com/youzan/vant/tree/v0.10.5) (2017-10-30) [Full Changelog](https://github.com/youzan/vant/compare/v0.10.4...v0.10.5) diff --git a/docs/examples-docs/zh-CN/changelog.md b/docs/examples-docs/zh-CN/changelog.md index 5b0e7e658..cfc7cee37 100644 --- a/docs/examples-docs/zh-CN/changelog.md +++ b/docs/examples-docs/zh-CN/changelog.md @@ -1,5 +1,16 @@ ## 更新日志 +### [0.10.6](https://github.com/youzan/vant/tree/v0.10.6) +`2017-11-06` + +**Improvements** +- 新增 Swipe initialSwipe 属性 [\#279](https://github.com/youzan/vant/pull/279) [@chenjiahan](https://github.com/chenjiahan) + +**Bug Fixes** +- 修复 Dialog 按钮文字未重置的问题 [\#278](https://github.com/youzan/vant/pull/278) [@chenjiahan](https://github.com/chenjiahan) +- 修复 Tab 动态生成问题 [\#284](https://github.com/youzan/vant/pull/284) [@cookfront](https://github.com/cookfront) +- 修复 NoticeBar 在页面返回时文字消失的问题 [\#280](https://github.com/youzan/vant/pull/280) [@chenjiahan](https://github.com/chenjiahan) + ### [0.10.5](https://github.com/youzan/vant/tree/v0.10.5) `2017-10-30` From 6c37a6906f68b5519ba938fb35b90f80455e7688 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 7 Nov 2017 02:22:17 -0600 Subject: [PATCH 48/49] [new feature] ImagePreview support startPosition (#286) * [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 * [new feature] Swipe add 'initialSwipe' prop * [bugfix] NoticeBar text disappeared when page back * [new feature] ImagePreview support startPosition * fix: improve imagePreview test cases --- docs/examples-docs/zh-CN/image-preview.md | 26 +++++++++++++++++++++-- packages/image-preview/image-preview.vue | 8 ++++--- packages/image-preview/index.js | 3 ++- packages/swipe/index.vue | 4 ++++ test/unit/specs/image-preview.spec.js | 7 +++++- 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/docs/examples-docs/zh-CN/image-preview.md b/docs/examples-docs/zh-CN/image-preview.md index 60cb65550..bc16e3fa4 100644 --- a/docs/examples-docs/zh-CN/image-preview.md +++ b/docs/examples-docs/zh-CN/image-preview.md @@ -16,12 +16,12 @@ import { ImagePreview } from 'packages'; export default { methods: { - showImagePreview() { + showImagePreview(position) { ImagePreview([ 'https://img.yzcdn.cn/upload_files/2017/03/15/FkubrzN7AgGwLlTeb1E89-T_ZjBg.png', 'https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg', 'https://img.yzcdn.cn/upload_files/2017/03/15/FvexrWlG_WxtCE9Omo5l27n_mAG_.jpeg' - ]); + ], typeof position === 'number' ? position : 0); } } }; @@ -60,8 +60,30 @@ export default { ``` ::: +#### 指定初始位置 + +:::demo 指定初始位置 +```html +指定初始位置 +``` + +```javascript +export default { + methods: { + showImagePreview(startPosition) { + ImagePreview([ + 'https://img.yzcdn.cn/1.jpg', + 'https://img.yzcdn.cn/2.jpg' + ], startPosition); + } + } +}; +``` +::: + ### 方法参数 | 参数名 | 说明 | 类型 | |-----------|-----------|-----------| | imageUrls | 需要预览的图片 | `Array` | +| startPosition | 图片预览起始位置索引 | `Number` | diff --git a/packages/image-preview/image-preview.vue b/packages/image-preview/image-preview.vue index ea0f8e084..46434e058 100644 --- a/packages/image-preview/image-preview.vue +++ b/packages/image-preview/image-preview.vue @@ -7,7 +7,7 @@ @touchend="onTouchEnd" @touchcancel="onTouchEnd" > - + @@ -44,7 +44,8 @@ export default { data() { return { - images: [] + images: [], + startPosition: 0 }; }, @@ -63,7 +64,8 @@ export default { this.deltaY = event.touches[0].clientY - this.touchStartY; }, - onTouchEnd() { + onTouchEnd(event) { + event.preventDefault(); // prevent long tap to close component const deltaTime = new Date() - this.touchStartTime; if (deltaTime < 100 && Math.abs(this.deltaX) < 20 && Math.abs(this.deltaY) < 20) { diff --git a/packages/image-preview/index.js b/packages/image-preview/index.js index 095ed6788..59c56d841 100644 --- a/packages/image-preview/index.js +++ b/packages/image-preview/index.js @@ -12,12 +12,13 @@ const initInstance = () => { document.body.appendChild(instance.$el); }; -const ImagePreviewBox = images => { +const ImagePreviewBox = (images, startPosition = 0) => { if (!instance) { initInstance(); } instance.images = images; + instance.startPosition = startPosition; instance.value = true; }; diff --git a/packages/swipe/index.vue b/packages/swipe/index.vue index f0af6ec74..760887a86 100644 --- a/packages/swipe/index.vue +++ b/packages/swipe/index.vue @@ -69,6 +69,10 @@ export default { watch: { swipes() { this.initialize(); + }, + + initialSwipe() { + this.initialize(); } }, diff --git a/test/unit/specs/image-preview.spec.js b/test/unit/specs/image-preview.spec.js index f2b1ffc30..1177d544c 100644 --- a/test/unit/specs/image-preview.spec.js +++ b/test/unit/specs/image-preview.spec.js @@ -21,7 +21,12 @@ describe('ImagePreview', () => { ImagePreview(images); Vue.nextTick(() => { expect(document.querySelectorAll('.van-image-preview img').length).to.equal(3); - done(); + ImagePreview(images.slice(0, 2)); + + Vue.nextTick(() => { + expect(document.querySelectorAll('.van-image-preview img').length).to.equal(2); + done(); + }); }); }); From f86afcb694dd3af91e50fe9a1d5d45c39329b265 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 7 Nov 2017 05:41:34 -0600 Subject: [PATCH 49/49] [bugfix] Steps style error when has more than 4 items (#287) * [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 * [new feature] Swipe add 'initialSwipe' prop * [bugfix] NoticeBar text disappeared when page back * [new feature] ImagePreview support startPosition * fix: improve imagePreview test cases * [bugfix] Steps style error when has more than 4 items --- packages/steps/index.vue | 12 +----------- packages/vant-css/src/steps.css | 14 ++------------ 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/packages/steps/index.vue b/packages/steps/index.vue index a333938be..9c01f7e84 100644 --- a/packages/steps/index.vue +++ b/packages/steps/index.vue @@ -1,5 +1,5 @@