diff --git a/.gitignore b/.gitignore index 41b8349a1..5f5aad3b6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ example/dist test/unit/coverage packages/vant-css/build packages/vant-css/icons +docs/examples-dist diff --git a/build/genExamples.js b/build/genExamples.js index ac4eebe59..b9ecdb6fb 100644 --- a/build/genExamples.js +++ b/build/genExamples.js @@ -1,114 +1,18 @@ -var markdownIt = require('markdown-it'); -var markdownItContainer = require('markdown-it-container'); -var fs = require('fs'); -var path = require('path'); -var cheerio = require('cheerio'); -var chalk = require('chalk'); -var decamelize = require('decamelize'); -var striptags = require('./strip-tags'); -var navs = require('../docs/src/nav.config.js'); -navs = navs['zh-CN']; +const path = require('path'); +const docConfig = require('../docs/src/doc.config'); +const { extractExample } = require('zan-doc/src/helper'); -var parser = markdownIt('default', { - html: true -}); - -var renderVueTemplate = function(html, componentTitle) { - var $ = cheerio.load(html, { - decodeEntities: false, - lowerCaseAttributeNames: false, - lowerCaseTags: false +function extract(watch = false) { + extractExample({ + src: path.resolve(__dirname, '../docs/examples-docs'), + dist: path.resolve(__dirname, '../docs/examples-dist'), + nav: docConfig['zh-CN'].nav, + watch }); +} - var output = { - style: $.html('style'), - script: $.html('script'), - 'example-block': $.html('example-block') - }; - var result; +extract(); - $('style').remove(); - $('script').remove(); - - var script = ''; - if (output.script) { - script = output.script.replace(''; - } - - var componentName = componentTitle.split(' ')[0]; - componentName = decamelize(componentName, '-'); - result = `\n' + - output.style + '\n' + - script; - - return result; +module.exports = function watch() { + extract(true); }; - -function convert(str) { - str = str.replace(/(&#x)(\w{4});/gi, function($0) { - return String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)); - }); - return str; -} - -parser.use(markdownItContainer, 'demo', { - validate: function(params) { - return params.trim().match(/^demo\s*(.*)$/); - }, - - render: function(tokens, idx) { - var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/); - if (tokens[idx].nesting === 1) { - var description = (m && m.length > 1) ? m[1] : ''; - var content = tokens[idx + 1].content; - var html = convert(striptags.strip(content, ['script', 'style'])); - - return ` - ${html} - \n`; - } - return ''; - } -}); - -var docsDir = path.resolve(__dirname, '../docs'); -var components = []; -for (var i = 0; i < navs.length; i++) { - var navItem = navs[i]; - - if (!navItem.showInMobile) continue; - - if (!navItem.groups) { - components.push(navs[i]); - } else { - for (var j = 0; j < navItem.groups.length; j++) { - components = components.concat(navItem.groups[j].list); - } - } -} -for (var i = 0; i < components.length; i++) { - var item = components[i]; - var itemMdFile = `${docsDir}/examples-docs${item.path}.md`; - if (!fs.existsSync(itemMdFile)) { - continue; - } - - var itemMd = fs.readFileSync(`${docsDir}/examples-docs${item.path}.md`).toString(); - var content = parser.render(itemMd); - var result = renderVueTemplate(content, item.title); - - var exampleVueName = `${docsDir}/examples-dist/${item.path}.vue`; - - // 新建一个文件 - if (!fs.existsSync(exampleVueName)) { - fs.closeSync(fs.openSync(exampleVueName, 'w')); - } - fs.writeFileSync(exampleVueName, result, { - encoding: 'utf8' - }); -} - -console.log(chalk.green('generate examples success!')); - diff --git a/build/release.sh b/build/release.sh index 247684c63..463c07e92 100644 --- a/build/release.sh +++ b/build/release.sh @@ -1,6 +1,16 @@ git checkout master git merge dev +basepath=$(dirname $0) + +if ! command_exists github_changelog_generator ; then + fail 'github_changelog_generator is required to publish packages' +fi + +if [ -z "$CHANGELOG_GITHUB_TOKEN" ] ; then + fail 'You must set CHANGELOG_GITHUB_TOKEN environment variable\nhttps://github.com/skywinder/github-changelog-generator#github-token' +fi + #!/usr/bin/env sh set -e echo "Enter release version: " @@ -12,6 +22,15 @@ if [[ $REPLY =~ ^[Yy]$ ]] then echo "Releasing $VERSION ..." + github_changelog_generator \ + --header-label "## 更新日志" \ + --bugs-label "**修复:**" \ + --enhancement-label "**非兼容更新和新特性:**" \ + --issues-label "**处理的 Issue:**" \ + --pr-label "**合并的 Pull Request (可能有不兼容改动):**" \ + --no-unreleased \ + -o $basepath/../docs/examples-docs/changelog.md + # build VERSION=$VERSION npm run dist diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js index 04ca6c82f..4294b858c 100644 --- a/build/webpack.config.dev.js +++ b/build/webpack.config.dev.js @@ -8,6 +8,12 @@ var ProgressBarPlugin = require('progress-bar-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') +const isProduction = process.env.NODE_ENV === 'production'; +const watchExample = require('./genExamples'); + +if (!isProduction) { + watchExample(); +} var StyleExtractPlugin; if (process.env.NODE_ENV === 'production') { @@ -32,7 +38,7 @@ function wrap(render) { module.exports = { entry: { - 'vendor': ['vue', 'vue-router'], + 'vendor': ['vue', 'vue-router', 'zan-doc'], 'vant-docs': './docs/src/index.js', 'vant-examples': './docs/src/examples.js' }, @@ -118,37 +124,23 @@ module.exports = { }, vueMarkdown: { use: [ - [require('markdown-it-anchor'), { - level: 2, - slugify: slugify, - permalink: true, - permalinkBefore: true - }], [require('markdown-it-container'), 'demo', { validate: function(params) { return params.trim().match(/^demo\s*(.*)$/); }, render: function(tokens, idx) { - var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/); if (tokens[idx].nesting === 1) { - var description = (m && m.length > 1) ? m[1] : ''; - var content = tokens[idx + 1].content; - var html = convert(striptags.strip(content, ['script', 'style'])); - - return ` -
${html}
-
`; + return `
`; } - return '
\n'; + return `
\n`; } }] ], preprocess: function(MarkdownIt, source) { MarkdownIt.renderer.rules.table_open = function() { - return ''; + return '
'; }; - MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence); return source; } } diff --git a/docs/assets/docs.css b/docs/assets/docs.css index 883417310..bbcf5edb1 100644 --- a/docs/assets/docs.css +++ b/docs/assets/docs.css @@ -97,11 +97,7 @@ code.hljs { margin: 20px 0; font-weight: normal; - &:hover a { - opacity: .4; - } - - a { + .header-anchor { float: left; margin-left: -20px; opacity: 0; diff --git a/docs/examples-dist/actionsheet.vue b/docs/examples-dist/actionsheet.vue deleted file mode 100644 index 9cad0d3de..000000000 --- a/docs/examples-dist/actionsheet.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/badge.vue b/docs/examples-dist/badge.vue deleted file mode 100644 index dccaffbce..000000000 --- a/docs/examples-dist/badge.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/button.vue b/docs/examples-dist/button.vue deleted file mode 100644 index 7a51f9f77..000000000 --- a/docs/examples-dist/button.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/card.vue b/docs/examples-dist/card.vue deleted file mode 100644 index 1e8a6c2af..000000000 --- a/docs/examples-dist/card.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/cell-swipe.vue b/docs/examples-dist/cell-swipe.vue deleted file mode 100644 index cd91bd534..000000000 --- a/docs/examples-dist/cell-swipe.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/cell.vue b/docs/examples-dist/cell.vue deleted file mode 100644 index cecd940e3..000000000 --- a/docs/examples-dist/cell.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/checkbox.vue b/docs/examples-dist/checkbox.vue deleted file mode 100644 index 89c897ed2..000000000 --- a/docs/examples-dist/checkbox.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/datetime-picker.vue b/docs/examples-dist/datetime-picker.vue deleted file mode 100644 index a3eba9767..000000000 --- a/docs/examples-dist/datetime-picker.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/dialog.vue b/docs/examples-dist/dialog.vue deleted file mode 100644 index 52a14caaa..000000000 --- a/docs/examples-dist/dialog.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/field.vue b/docs/examples-dist/field.vue deleted file mode 100644 index 1241f24af..000000000 --- a/docs/examples-dist/field.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/icon.vue b/docs/examples-dist/icon.vue deleted file mode 100644 index 40620f0e0..000000000 --- a/docs/examples-dist/icon.vue +++ /dev/null @@ -1,290 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/image-preview.vue b/docs/examples-dist/image-preview.vue deleted file mode 100644 index 28572f8a9..000000000 --- a/docs/examples-dist/image-preview.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/layout.vue b/docs/examples-dist/layout.vue deleted file mode 100644 index 99f74fa79..000000000 --- a/docs/examples-dist/layout.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/lazyload.vue b/docs/examples-dist/lazyload.vue deleted file mode 100644 index c8d1579c2..000000000 --- a/docs/examples-dist/lazyload.vue +++ /dev/null @@ -1,78 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/loading.vue b/docs/examples-dist/loading.vue deleted file mode 100644 index 15f88434f..000000000 --- a/docs/examples-dist/loading.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/panel.vue b/docs/examples-dist/panel.vue deleted file mode 100644 index c4a86f503..000000000 --- a/docs/examples-dist/panel.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/picker.vue b/docs/examples-dist/picker.vue deleted file mode 100644 index c530067af..000000000 --- a/docs/examples-dist/picker.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/popup.vue b/docs/examples-dist/popup.vue deleted file mode 100644 index 1db6b6907..000000000 --- a/docs/examples-dist/popup.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/progress.vue b/docs/examples-dist/progress.vue deleted file mode 100644 index bdc489ae2..000000000 --- a/docs/examples-dist/progress.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/quantity.vue b/docs/examples-dist/quantity.vue deleted file mode 100644 index e2d0ddb94..000000000 --- a/docs/examples-dist/quantity.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/radio.vue b/docs/examples-dist/radio.vue deleted file mode 100644 index 978319c8a..000000000 --- a/docs/examples-dist/radio.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/search.vue b/docs/examples-dist/search.vue deleted file mode 100644 index 0a05cfb6e..000000000 --- a/docs/examples-dist/search.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/steps.vue b/docs/examples-dist/steps.vue deleted file mode 100644 index 735c128fb..000000000 --- a/docs/examples-dist/steps.vue +++ /dev/null @@ -1,76 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/swipe.vue b/docs/examples-dist/swipe.vue deleted file mode 100644 index 338fdf8ba..000000000 --- a/docs/examples-dist/swipe.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/switch.vue b/docs/examples-dist/switch.vue deleted file mode 100644 index 4026260c3..000000000 --- a/docs/examples-dist/switch.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/tab.vue b/docs/examples-dist/tab.vue deleted file mode 100644 index fa8534e5d..000000000 --- a/docs/examples-dist/tab.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/tag.vue b/docs/examples-dist/tag.vue deleted file mode 100644 index 407388999..000000000 --- a/docs/examples-dist/tag.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/toast.vue b/docs/examples-dist/toast.vue deleted file mode 100644 index 918f64275..000000000 --- a/docs/examples-dist/toast.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/uploader.vue b/docs/examples-dist/uploader.vue deleted file mode 100644 index ddeb29917..000000000 --- a/docs/examples-dist/uploader.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-dist/waterfall.vue b/docs/examples-dist/waterfall.vue deleted file mode 100644 index 3a9951243..000000000 --- a/docs/examples-dist/waterfall.vue +++ /dev/null @@ -1,73 +0,0 @@ - - - \ No newline at end of file diff --git a/docs/examples-docs/card.md b/docs/examples-docs/card.md index 82a0a1b8a..74d652d65 100644 --- a/docs/examples-docs/card.md +++ b/docs/examples-docs/card.md @@ -77,6 +77,7 @@ export default { | thumb | 左侧图片 | `string` | | | | title | 标题 | `string` | | | | desc | 描述 | `string` | | | +| centered | 内容是否垂直居中 | `string` | `false` | | ### Slot diff --git a/docs/examples-docs/changelog.md b/docs/examples-docs/changelog.md new file mode 100644 index 000000000..4f4aba483 --- /dev/null +++ b/docs/examples-docs/changelog.md @@ -0,0 +1,182 @@ +## 更新日志 + +## [v0.6.5](https://github.com/youzan/vant/tree/v0.6.5) (2017-07-11) +[Full Changelog](https://github.com/youzan/vant/compare/v0.6.4...v0.6.5) + +**非兼容更新和新特性:** + +- tabs组件支持滑动 [\#52](https://github.com/youzan/vant/pull/52) ([cookfront](https://github.com/cookfront)) + +**处理的 Issue:** + +- 有计划都生成vue版本吗 [\#50](https://github.com/youzan/vant/issues/50) + +## [v0.6.4](https://github.com/youzan/vant/tree/v0.6.4) (2017-07-06) +[Full Changelog](https://github.com/youzan/vant/compare/v0.6.3...v0.6.4) + +**非兼容更新和新特性:** + +- src/utils目录支持SSR [\#51](https://github.com/youzan/vant/pull/51) ([cookfront](https://github.com/cookfront)) + +## [v0.6.3](https://github.com/youzan/vant/tree/v0.6.3) (2017-07-04) +[Full Changelog](https://github.com/youzan/vant/compare/v0.6.2...v0.6.3) + +**非兼容更新和新特性:** + +- 步骤条组件新增direction和activeColor属性,增加了竖的步骤条 [\#49](https://github.com/youzan/vant/pull/49) ([cookfront](https://github.com/cookfront)) +- Card component supoort thumb slot,use flex layout [\#48](https://github.com/youzan/vant/pull/48) ([chenjiahan](https://github.com/chenjiahan)) + +**修复:** + +- 修复人民币符号在ios显示问题 [\#44](https://github.com/youzan/vant/pull/44) ([w91](https://github.com/w91)) + +**处理的 Issue:** + +- goods-action 文档有误 [\#47](https://github.com/youzan/vant/issues/47) + +## [v0.6.2](https://github.com/youzan/vant/tree/v0.6.2) (2017-06-26) +[Full Changelog](https://github.com/youzan/vant/compare/v0.6.1...v0.6.2) + +**非兼容更新和新特性:** + +- 新增icon、filed组件新增time类型和Dialog组件默认文案修改 [\#43](https://github.com/youzan/vant/pull/43) ([cookfront](https://github.com/cookfront)) + +## [v0.6.1](https://github.com/youzan/vant/tree/v0.6.1) (2017-06-19) +[Full Changelog](https://github.com/youzan/vant/compare/v0.6.0...v0.6.1) + +**修复:** + +- 新增icon和修复toast样式问题 [\#42](https://github.com/youzan/vant/pull/42) ([cookfront](https://github.com/cookfront)) + +## [v0.6.0](https://github.com/youzan/vant/tree/v0.6.0) (2017-06-15) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.12...v0.6.0) + +**非兼容更新和新特性:** + +- Search组件新增微杂志样式 [\#38](https://github.com/youzan/vant/pull/38) ([cookfront](https://github.com/cookfront)) +- 支持SSR、升级Vue版本和增加新的icon [\#40](https://github.com/youzan/vant/pull/40) ([cookfront](https://github.com/cookfront)) +- 增加cell swipe组件 [\#39](https://github.com/youzan/vant/pull/39) ([tsxuehu](https://github.com/tsxuehu)) + +## [v0.5.12](https://github.com/youzan/vant/tree/v0.5.12) (2017-06-02) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.11...v0.5.12) + +**处理的 Issue:** + +- 业务组件的cap-goods-list出现问题 [\#36](https://github.com/youzan/vant/issues/36) + +**合并的 Pull Request (可能有不兼容改动):** + +- utils/scroll [\#37](https://github.com/youzan/vant/pull/37) ([pangxie1991](https://github.com/pangxie1991)) + +## [v0.5.11](https://github.com/youzan/vant/tree/v0.5.11) (2017-05-25) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.10...v0.5.11) + +**合并的 Pull Request (可能有不兼容改动):** + +- 移除postcss-reset [\#35](https://github.com/youzan/vant/pull/35) ([cookfront](https://github.com/cookfront)) + +## [v0.5.10](https://github.com/youzan/vant/tree/v0.5.10) (2017-05-25) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.9...v0.5.10) + +## [v0.5.9](https://github.com/youzan/vant/tree/v0.5.9) (2017-05-25) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.8...v0.5.9) + +**合并的 Pull Request (可能有不兼容改动):** + +- 新增微信导航icon [\#34](https://github.com/youzan/vant/pull/34) ([cookfront](https://github.com/cookfront)) + +## [v0.5.8](https://github.com/youzan/vant/tree/v0.5.8) (2017-05-25) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.7...v0.5.8) + +**修复:** + +- 修复长按图片后,图片会隐藏问题 [\#32](https://github.com/youzan/vant/pull/32) ([w91](https://github.com/w91)) + +**合并的 Pull Request (可能有不兼容改动):** + +- 新增微信导航icon [\#33](https://github.com/youzan/vant/pull/33) ([cookfront](https://github.com/cookfront)) + +## [v0.5.7](https://github.com/youzan/vant/tree/v0.5.7) (2017-05-19) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.6...v0.5.7) + +**非兼容更新和新特性:** + +- picker 增加 title 显示 [\#30](https://github.com/youzan/vant/pull/30) ([pangxie1991](https://github.com/pangxie1991)) + +**合并的 Pull Request (可能有不兼容改动):** + +- 更新reset中body背景色 [\#31](https://github.com/youzan/vant/pull/31) ([w91](https://github.com/w91)) + +## [v0.5.6](https://github.com/youzan/vant/tree/v0.5.6) (2017-05-15) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.4...v0.5.6) + +**合并的 Pull Request (可能有不兼容改动):** + +- 添加两个新的icon [\#29](https://github.com/youzan/vant/pull/29) ([cookfront](https://github.com/cookfront)) +- 改变打包出来的amd模块,增加amd模块的名字 [\#28](https://github.com/youzan/vant/pull/28) ([pangxie1991](https://github.com/pangxie1991)) + +## [v0.5.4](https://github.com/youzan/vant/tree/v0.5.4) (2017-05-09) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.3...v0.5.4) + +**修复:** + +- 修复:添加reset.css和cell加上right-icon的slot [\#27](https://github.com/youzan/vant/pull/27) ([cookfront](https://github.com/cookfront)) +- 修复:cell同时设置title和label时,value不居中 [\#26](https://github.com/youzan/vant/pull/26) ([cookfront](https://github.com/cookfront)) +- 修复:popup的zIndex转换为number [\#24](https://github.com/youzan/vant/pull/24) ([cookfront](https://github.com/cookfront)) + +**合并的 Pull Request (可能有不兼容改动):** + +- fix bugs and add new features [\#25](https://github.com/youzan/vant/pull/25) ([radicalviva](https://github.com/radicalviva)) + +## [v0.5.3](https://github.com/youzan/vant/tree/v0.5.3) (2017-04-27) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.2...v0.5.3) + +**修复:** + +- 修复:picker中值变了后未更新picker-colum中的值 [\#23](https://github.com/youzan/vant/pull/23) ([cookfront](https://github.com/cookfront)) + +## [v0.5.2](https://github.com/youzan/vant/tree/v0.5.2) (2017-04-26) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.1...v0.5.2) + +**处理的 Issue:** + +- does it render UI Natively just like React - Native or like ionic ? [\#15](https://github.com/youzan/vant/issues/15) +- give me an english version of this : https://www.youzanyun.com/zanui/react/guides/install [\#14](https://github.com/youzan/vant/issues/14) + +**合并的 Pull Request (可能有不兼容改动):** + +- 修复:webpack打包修复 [\#21](https://github.com/youzan/vant/pull/21) ([cookfront](https://github.com/cookfront)) +- unit test: picker [\#20](https://github.com/youzan/vant/pull/20) ([cookfront](https://github.com/cookfront)) +- Fix: 修复toast关闭时未移除Dom节点,以及补上单元测试 [\#19](https://github.com/youzan/vant/pull/19) ([cookfront](https://github.com/cookfront)) +- tabs 组件修改 [\#18](https://github.com/youzan/vant/pull/18) ([pangxie1991](https://github.com/pangxie1991)) +- 补充 Col & Row 测试用例 [\#16](https://github.com/youzan/vant/pull/16) ([w91](https://github.com/w91)) +- 单元测试 排除src/目录 [\#13](https://github.com/youzan/vant/pull/13) ([pangxie1991](https://github.com/pangxie1991)) +- 添加单元测试 [\#12](https://github.com/youzan/vant/pull/12) ([cookfront](https://github.com/cookfront)) +- test 环境不跑 PhantomJS [\#11](https://github.com/youzan/vant/pull/11) ([pangxie1991](https://github.com/pangxie1991)) +- 修改 unit test 的配置 [\#10](https://github.com/youzan/vant/pull/10) ([pangxie1991](https://github.com/pangxie1991)) +- unit test: uploader [\#9](https://github.com/youzan/vant/pull/9) ([tsxuehu](https://github.com/tsxuehu)) +- 文档页样式优化和打包配置优化 [\#8](https://github.com/youzan/vant/pull/8) ([cookfront](https://github.com/cookfront)) +- 修复表单组件样式和单元测试用例 [\#7](https://github.com/youzan/vant/pull/7) ([cookfront](https://github.com/cookfront)) +- 文档小细节优化 [\#6](https://github.com/youzan/vant/pull/6) ([cookfront](https://github.com/cookfront)) + +## [v0.5.1](https://github.com/youzan/vant/tree/v0.5.1) (2017-04-24) +[Full Changelog](https://github.com/youzan/vant/compare/v0.5.0...v0.5.1) + +**合并的 Pull Request (可能有不兼容改动):** + +- 文档细节优化,search、loading和dialog组件样式修复 [\#5](https://github.com/youzan/vant/pull/5) ([cookfront](https://github.com/cookfront)) + +## [v0.5.0](https://github.com/youzan/vant/tree/v0.5.0) (2017-04-23) +**处理的 Issue:** + +- 一些建议 [\#1](https://github.com/youzan/vant/issues/1) + +**合并的 Pull Request (可能有不兼容改动):** + +- use vue in amd & commonjs, use Vue in root [\#4](https://github.com/youzan/vant/pull/4) ([pangxie1991](https://github.com/pangxie1991)) +- 手机端样式细节调整,补充测试用例 [\#3](https://github.com/youzan/vant/pull/3) ([cookfront](https://github.com/cookfront)) +- 补充waterfall文档,依赖vue改为Vue [\#2](https://github.com/youzan/vant/pull/2) ([pangxie1991](https://github.com/pangxie1991)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/docs/examples-docs/field.md b/docs/examples-docs/field.md index c2223ff99..5dc74c679 100644 --- a/docs/examples-docs/field.md +++ b/docs/examples-docs/field.md @@ -14,6 +14,15 @@ export default { return { username: 'zhangmin' }; + }, + methods: { + onIconClick() { + this.username = ''; + }, + + onFieldBlur() { + console.log('blured'); + } } }; @@ -62,7 +71,15 @@ export default { :::demo 基础用法 ```html - + @@ -145,4 +162,6 @@ export default { | rows | textarea rows | `string`, `number` | | | | cols | textarea cols | `string`, `number` | | | | autosize | 自动调整高度(仅支持textarea) | `boolean` | `false` | `true`, `false` | +| icon | 输入框尾部图标 | `string` | | icon中支持的类型 | +| onIconClick | 点击图标的回调函数 | `function` | | | diff --git a/docs/examples-docs/icon.md b/docs/examples-docs/icon.md index 17dc41d98..f2d7d7079 100644 --- a/docs/examples-docs/icon.md +++ b/docs/examples-docs/icon.md @@ -58,7 +58,7 @@ export default { 设置`name`属性为对应的图标名称即可: -:::demo 所有Icon +:::demo 基础用法 ```html ``` diff --git a/docs/examples-docs/quickstart.md b/docs/examples-docs/quickstart.md index 3636ce4f2..c0b202cc7 100644 --- a/docs/examples-docs/quickstart.md +++ b/docs/examples-docs/quickstart.md @@ -1,7 +1,8 @@ ## Vant -一套基于`Vue.js 2.0`的Mobile组件库 -
A Vue.js 2.0 Mobile UI +一套基于`Vue.js 2.0`的 Mobile 组件库 + +[查看业务组件库 Captain-UI](https://www.youzanyun.com/zanui/captain/component/quickstart) ### 安装 diff --git a/docs/src/ExamplesDocsApp.vue b/docs/src/ExamplesDocsApp.vue index 19ad99e08..c8753bf7f 100644 --- a/docs/src/ExamplesDocsApp.vue +++ b/docs/src/ExamplesDocsApp.vue @@ -1,40 +1,30 @@ diff --git a/docs/src/components/demo-block.vue b/docs/src/components/demo-block.vue index 50dfb211e..466594eaf 100644 --- a/docs/src/components/demo-block.vue +++ b/docs/src/components/demo-block.vue @@ -1,66 +1,15 @@ - - diff --git a/docs/src/components/demo-list.vue b/docs/src/components/demo-list.vue index 301202bb9..87d9ecdd5 100644 --- a/docs/src/components/demo-list.vue +++ b/docs/src/components/demo-list.vue @@ -13,7 +13,7 @@ - - diff --git a/docs/src/components/page-footer.vue b/docs/src/components/page-footer.vue deleted file mode 100644 index d840c518b..000000000 --- a/docs/src/components/page-footer.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/docs/src/components/page-header.vue b/docs/src/components/page-header.vue deleted file mode 100644 index f0cf42a77..000000000 --- a/docs/src/components/page-header.vue +++ /dev/null @@ -1,146 +0,0 @@ - - - - - diff --git a/docs/src/components/side-nav.vue b/docs/src/components/side-nav.vue deleted file mode 100644 index 98298acf4..000000000 --- a/docs/src/components/side-nav.vue +++ /dev/null @@ -1,124 +0,0 @@ - - - - - diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js new file mode 100644 index 000000000..b58bf3a99 --- /dev/null +++ b/docs/src/doc.config.js @@ -0,0 +1,181 @@ +/* eslint-disable */ +module.exports = { + "zh-CN": { + header: { + '首页': 'https://www.youzanyun.com/zanui', + 'PC端': 'https://www.youzanyun.com/zanui/react', + '移动端': 'https://www.youzanyun.com/zanui/vue', + '微信小程序': 'https://github.com/youzan/zanui-weapp' + }, + footer: { + copyright: `2012-${(new Date()).getFullYear()} © youzanyun.com - 浙公网安备 33010602004354号 增值电信业务经营许可证:浙B2-20140331 - 浙ICP备13037466号`, + nav: { + '有赞官网': 'https://www.youzan.com/', + '有赞云': 'http://www.youzanyun.com/zanui', + '加入我们': 'https://job.youzan.com/' + } + }, + nav: [ + { + "name": "开发指南", + "groups": [ + { + "list": [ + { + "path": "/quickstart", + "title": "快速上手", + noExample: true + }, + { + "path": "/changelog", + "title": "更新日志", + noExample: true + } + ] + } + ] + }, + { + "name": "Vant组件", + "showInMobile": true, + "groups": [ + { + "groupName": "基础组件", + "list": [ + { + "path": "/layout", + "title": "Layout 布局" + }, + { + "path": "/button", + "title": "Button 按钮" + }, + { + "path": "/icon", + "title": "Icon 图标" + }, + { + "path": "/cell", + "title": "Cell 单元格" + }, + { + "path": "/cell-swipe", + "title": "Cell Swipe 滑动单元格" + }, + { + "path": "/progress", + "title": "Progress 进度条" + }, + { + "path": "/card", + "title": "Card 图文组件" + }, + { + "path": "/panel", + "title": "Panel 面板" + }, + { + "path": "/loading", + "title": "Loading 加载" + }, + { + "path": "/steps", + "title": "Steps 步骤条" + }, + { + "path": "/tag", + "title": "Tag 标记" + }, + { + "path": "/badge", + "title": "Badge 徽章" + }, + { + "path": "/tab", + "title": "Tab 标签" + }, + { + "path": "/popup", + "title": "Popup 弹出菜单" + }, + { + "path": "/swipe", + "title": "Swipe 轮播" + }, + { + "path": "/search", + "title": "Search 搜索" + }, + { + "path": "/quantity", + "title": "Quantity 数量选择" + }, + { + "path": "/waterfall", + "title": "Waterfall 瀑布流" + }, + { + "path": "/image-preview", + "title": "ImagePreview 图片预览" + }, + { + "path": "/lazyload", + "title": "Lazyload 图片懒加载" + } + ] + }, + { + "groupName": "表单", + "list": [ + { + "path": "/switch", + "title": "Switch 开关" + }, + { + "path": "/field", + "title": "Field 输入框" + }, + { + "path": "/radio", + "title": "Radio 单选框" + }, + { + "path": "/checkbox", + "title": "Checkbox 复选框" + }, + { + "path": "/uploader", + "title": "Uploader 图片上传" + } + ] + }, + { + "groupName": "操作反馈", + "list": [ + { + "path": "/actionsheet", + "title": "Actionsheet 行动按钮" + }, + { + "path": "/toast", + "title": "Toast 轻提示" + }, + { + "path": "/picker", + "title": "Picker 选择器" + }, + { + "path": "/datetime-picker", + "title": "Datetime Picker 时间选择" + }, + { + "path": "/dialog", + "title": "Dialog 弹出框" + } + ] + } + ] + } + ] + } +} diff --git a/docs/src/examples.js b/docs/src/examples.js index 3018f60f2..d6d0c5d6d 100644 --- a/docs/src/examples.js +++ b/docs/src/examples.js @@ -1,21 +1,21 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './ExamplesApp'; -import navConfig from './nav.config.js'; import routes from './router.config'; import ZanUI from 'src/index'; - +import ZanDoc from 'zan-doc'; import 'packages/vant-css/src/index.css'; import DemoList from './components/demo-list.vue'; Vue.use(ZanUI); +Vue.use(ZanDoc); Vue.use(ZanUI.Lazyload, { lazyComponent: true }); Vue.use(VueRouter); -const routesConfig = routes(navConfig, true); +const routesConfig = routes(true); routesConfig.push({ path: '/', component: DemoList.default || DemoList diff --git a/docs/src/index.js b/docs/src/index.js index 14d173937..2f7c3b729 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -1,10 +1,11 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './ExamplesDocsApp'; -import navConfig from './nav.config.js'; import routes from './router.config'; import ZanUI from 'src/index.js'; +import ZanDoc from 'zan-doc'; import packageJson from '../../package.json'; +import DemoBlock from './components/demo-block'; const global = { version: packageJson.version @@ -22,11 +23,13 @@ function isMobile() { Vue.use(VueRouter); Vue.use(ZanUI); +Vue.use(ZanDoc); Vue.use(ZanUI.Lazyload, { lazyComponent: true }); +Vue.component('demo-block', DemoBlock); -const routesConfig = routes(navConfig); +const routesConfig = routes(); routesConfig.push({ path: '/', redirect: '/component/quickstart' diff --git a/docs/src/nav.config.js b/docs/src/nav.config.js deleted file mode 100644 index 6f155b732..000000000 --- a/docs/src/nav.config.js +++ /dev/null @@ -1,159 +0,0 @@ -/* eslint-disable */ -module.exports = { - "zh-CN": [ - { - "name": "开发指南", - "groups": [ - { - "list": [ - { - "path": "/quickstart", - "title": "快速上手" - } - ] - } - ] - }, - { - "name": "Vant组件", - "showInMobile": true, - "groups": [ - { - "groupName": "基础组件", - "list": [ - { - "path": "/layout", - "title": "Layout 布局" - }, - { - "path": "/button", - "title": "Button 按钮" - }, - { - "path": "/icon", - "title": "Icon 图标" - }, - { - "path": "/cell", - "title": "Cell 单元格" - }, - { - "path": "/cell-swipe", - "title": "Cell Swipe 滑动单元格" - }, - { - "path": "/progress", - "title": "Progress 进度条" - }, - { - "path": "/card", - "title": "Card 图文组件" - }, - { - "path": "/panel", - "title": "Panel 面板" - }, - { - "path": "/loading", - "title": "Loading 加载" - }, - { - "path": "/steps", - "title": "Steps 步骤条" - }, - { - "path": "/tag", - "title": "Tag 标记" - }, - { - "path": "/badge", - "title": "Badge 徽章" - }, - { - "path": "/tab", - "title": "Tab 标签" - }, - { - "path": "/popup", - "title": "Popup 弹出菜单" - }, - { - "path": "/swipe", - "title": "Swipe 轮播" - }, - { - "path": "/search", - "title": "Search 搜索" - }, - { - "path": "/quantity", - "title": "Quantity 数量选择" - }, - { - "path": "/waterfall", - "title": "Waterfall 瀑布流" - }, - { - "path": "/image-preview", - "title": "ImagePreview 图片预览" - }, - { - "path": "/lazyload", - "title": "Lazyload 图片懒加载" - } - ] - }, - { - "groupName": "表单", - "list": [ - { - "path": "/switch", - "title": "Switch 开关" - }, - { - "path": "/field", - "title": "Field 输入框" - }, - { - "path": "/radio", - "title": "Radio 单选框" - }, - { - "path": "/checkbox", - "title": "Checkbox 复选框" - }, - { - "path": "/uploader", - "title": "Uploader 图片上传" - } - ] - }, - { - "groupName": "操作反馈", - "list": [ - { - "path": "/actionsheet", - "title": "Actionsheet 行动按钮" - }, - { - "path": "/toast", - "title": "Toast 轻提示" - }, - { - "path": "/picker", - "title": "Picker 选择器" - }, - { - "path": "/datetime-picker", - "title": "Datetime Picker 时间选择" - }, - { - "path": "/dialog", - "title": "Dialog 弹出框" - } - ] - } - ] - } - ] -} diff --git a/docs/src/router.config.js b/docs/src/router.config.js index 77c2502e9..19d7ad0a3 100644 --- a/docs/src/router.config.js +++ b/docs/src/router.config.js @@ -1,6 +1,7 @@ -const registerRoute = (navConfig, isExample) => { +const navs = require('./doc.config')['zh-CN'].nav; + +const registerRoute = (isExample) => { let route = []; - let navs = navConfig['zh-CN']; navs.forEach(nav => { if (isExample && !nav.showInMobile) { return; diff --git a/package.json b/package.json index 1b06c7654..a984d1d87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "0.6.5", + "version": "0.6.6", "description": "有赞vue wap组件库", "main": "lib/vant.js", "style": "lib/vant-css/index.css", @@ -134,6 +134,7 @@ "webpack-dev-server": "^1.16.3", "webpack-merge": "^2.0.0", "webpack-node-externals": "^1.5.4", - "webpack-vendor-chunk-plugin": "^1.0.0" + "webpack-vendor-chunk-plugin": "^1.0.0", + "zan-doc": "^0.1.0" } } diff --git a/packages/card/src/card.vue b/packages/card/src/card.vue index 9860cbade..387b8f9cc 100644 --- a/packages/card/src/card.vue +++ b/packages/card/src/card.vue @@ -1,5 +1,5 @@