diff --git a/.github/CONTRIBUTING.zh-CN.md b/.github/CONTRIBUTING.zh-CN.md
index 6d481cdd7..b10f3e3a0 100644
--- a/.github/CONTRIBUTING.zh-CN.md
+++ b/.github/CONTRIBUTING.zh-CN.md
@@ -30,7 +30,7 @@ npm run dev
- 仓库的组件代码都位于 `packages` 下,每个组件一个文件夹
- 所有的组件样式代码都位于 `packages/vant-css/src` 下,`vant-css` 也会在发布时单独发包
-- `docs/examples-docs` 目录下是文档网站的代码,根据语言划分为 zh-CN 和 en-US,本地开发时可以在根目录下运行 `npm run dev` 开启文档网站。
+- `docs/markdown` 目录下是文档网站的代码,根据语言划分为 zh-CN 和 en-US,本地开发时可以在根目录下运行 `npm run dev` 开启文档网站。
项目目录大致如下:
@@ -58,7 +58,7 @@ vant
- 添加文档
-新组件的文档编写,需要在 `docs/examples-docs` 下各个语言中新建对应同名文档 `button.md`,并在 `docs/src/doc.config.js` 中进行文档路径配置
+新组件的文档编写,需要在 `docs/markdown` 下各个语言中新建对应同名文档 `button.md`,在 `docs/demos` 下创建组件示例,并在 `docs/src/doc.config.js` 中进行配置组件名称
- 添加测试代码
@@ -67,7 +67,7 @@ vant
## 组件文档如何编写
-`docs/examples-docs` 下根据语言划分了组件文档,每个组件需要在各语言中编辑对应的文档。组件文档采用 markdown 格式,内容包括使用示例以及 `API` 等。具体书写规范请参考 [组件文档书写规范](./MARKDOWN.md)。
+`docs/markdown` 下根据语言划分了组件文档,每个组件需要在各语言中编辑对应的文档。组件文档采用 markdown 格式,内容包括使用示例以及 `API` 等。具体书写规范请参考 [组件文档书写规范](./MARKDOWN.md)。
#### API 说明
@@ -106,5 +106,5 @@ vant
`z-index` 优先级(从高到低):
* 特殊组件:Toast 永远在最上面,[3000, +∞)
-* ‘用完就关’ 的组件:Dialog, Pop, Actionsheet, image-preview 等 [2000, 3000)
+* ‘用完就关’ 的组件:Dialog, Pop, Actionsheet, ImagePreview 等 [2000, 3000)
* 其他:组件内部用来控制层次的 z-index 的区间 [-10, 10],尽可能写小,一般1,2,3这种就够了。
diff --git a/.github/MARKDOWN.md b/.github/MARKDOWN.md
index 96ded0eb4..ade817155 100644
--- a/.github/MARKDOWN.md
+++ b/.github/MARKDOWN.md
@@ -18,28 +18,24 @@
#### 代码演示
-另起一个二级标题,正文可以是 markdown 和示例的混合。示例的结构如下:
+另起一个二级标题,示例的结构如下:
- // 在 demo 端之外放置的 script 会直接运行
- // 在 script 中声明的 vue 变量,在 demo 中都可以直接使用
-
+ ```javascript
+ export default {
+ data() {
+ return {
+ size: 'large'
+ };
+ }
+ };
+ ```
+
+ ```html
+
+ Large
+
+ ```
- :::demo 基础用法(必须以:::demo开头,后面的描述可选,如果有的话控制在一两句话,不要过长)
- ```html // :::demo后面必须接代码段,否则不会识别为示例
- // 在内容区直接写 vue 中 template 段代码即可
- Large
-
- ```
- ::: // 示例结束的标记,必须接在代码段之后,否则不会识别为示例
-
代码演示的几个书写原则:
- 从简单用法开始介绍,不要上来就同时使用一大堆 API,会让人觉得难以上手
diff --git a/build/bin/build-entry.js b/build/bin/build-entry.js
index 27c7b9e96..9877586a0 100644
--- a/build/bin/build-entry.js
+++ b/build/bin/build-entry.js
@@ -1,28 +1,37 @@
-var Components = require('./get-components')();
-var fs = require('fs');
-var render = require('json-templater/string');
-var uppercamelcase = require('uppercamelcase');
-var path = require('path');
+const Components = require('./get-components')();
+const fs = require('fs');
+const path = require('path');
+const uppercamelize = require('uppercamelcase');
+const version = process.env.VERSION || require('../../package.json').version;
+const tips = '// This file is auto gererated by build/bin/build-entry.js';
-var OUTPUT_PATH = path.join(__dirname, '../../packages/index.js');
-var IMPORT_TEMPLATE = 'import {{name}} from \'./{{package}}\';';
-var ISNTALL_COMPONENT_TEMPLATE = ' {{name}}';
-var MAIN_TEMPLATE = `{{include}}
+function buildVantEntry() {
+ const uninstallComponents = [
+ 'Lazyload',
+ 'Waterfall',
+ 'Dialog',
+ 'Toast',
+ 'ImagePreview',
+ 'Locale'
+ ];
-const version = '{{version}}';
+ const importList = Components.map(name => `import ${uppercamelize(name)} from './${name}';`);
+ const exportList = Components.map(name => `${uppercamelize(name)}`);
+ const intallList = exportList.filter(name => !~uninstallComponents.indexOf(uppercamelize(name)));
+ const content = `${tips}
+${importList.join('\n')}
+
+const version = '${version}';
const components = [
-{{components}}
+ ${intallList.join(',\n ')}
];
-const install = function(Vue) {
- if (install.installed) return;
-
+const install = Vue => {
components.forEach(component => {
Vue.component(component.name, component);
});
};
-/* istanbul ignore if */
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
@@ -30,54 +39,72 @@ if (typeof window !== 'undefined' && window.Vue) {
export {
install,
version,
-{{list}}
+ ${exportList.join(',\n ')}
};
+
export default {
install,
version
};
`;
-delete Components.font;
+ fs.writeFileSync(path.join(__dirname, '../../packages/index.js'), content);
+}
-var includeComponentTemplate = [];
-var installTemplate = [];
-var listTemplate = [];
+function buildDemoEntry() {
+ const dir = path.join(__dirname, '../../docs/demos/views');
+ const demos = fs.readdirSync(dir)
+ .filter(name => ~name.indexOf('.vue'))
+ .map(name => name.replace('.vue', ''))
+ .map(name => `'${name}': r => require.ensure([], () => r(wrapper(require('./views/${name}'), '${name}')), '${name}')`);
-Components.forEach(name => {
- var componentName = uppercamelcase(name);
+ const content = `${tips}
+import './common';
- includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
- name: componentName,
- package: name
- }));
+function wrapper(component, name) {
+ component = component.default;
+ component.name = 'demo-' + name;
+ return component;
+}
- if ([
- // directives
- 'Lazyload',
- 'Waterfall',
+export default {
+ ${demos.join(',\n ')}
+};
+`;
+ fs.writeFileSync(path.join(dir, '../index.js'), content);
+}
- // services
- 'Dialog',
- 'Toast',
- 'ImagePreview'
- ].indexOf(componentName) === -1) {
- installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
- name: componentName,
- component: name
- }));
- }
+function buildDocsEntry() {
+ const dir = path.join(__dirname, '../../docs/markdown');
+ const cnDocs = fs.readdirSync(path.join(dir, 'zh-CN')).map(name => 'zh-CN/' + name);
+ const enDocs = fs.readdirSync(path.join(dir, 'en-US')).map(name => 'en-US/' + name);
+ const docs = [...cnDocs, ...enDocs]
+ .filter(name => name.indexOf('.md') !== -1)
+ .map(name => name.replace('.md', ''))
+ .map(name => `'${name}': wrapper(r => require.ensure([], () => r(require('./${name}.md')), '${name}'))`);
- listTemplate.push(` ${componentName}`);
-});
+ const content = `${tips}
+import progress from 'nprogress';
+import 'nprogress/nprogress.css';
-var template = render(MAIN_TEMPLATE, {
- include: includeComponentTemplate.join('\n'),
- list: listTemplate.join(',\n'),
- components: installTemplate.join(',\n') || ' ',
- version: process.env.VERSION || require('../../package.json').version
-});
+function wrapper(component) {
+ return function(r) {
+ progress.start();
+ component(r).then(() => {
+ progress.done();
+ }).catch(() => {
+ progress.done();
+ });
+ };
+}
-fs.writeFileSync(OUTPUT_PATH, template);
-console.log('[build entry] DONE:' + OUTPUT_PATH);
+export default {
+ ${docs.join(',\n ')}
+};
+`;
+ fs.writeFileSync(path.join(dir, './index.js'), content);
+}
+buildVantEntry();
+buildDemoEntry();
+buildDocsEntry();
diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js
index 1ecb1ab43..9d344221b 100644
--- a/build/webpack.config.dev.js
+++ b/build/webpack.config.dev.js
@@ -6,20 +6,11 @@ const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';
const docConfig = require('../docs/src/doc.config');
-const { extractExample } = require('zan-doc/src/helper');
const styleLoaders = [
{ loader: 'css-loader' },
{ loader: 'postcss-loader', options: { sourceMap: true } }
];
-// extract [components].vue from [components].md
-extractExample({
- src: path.resolve(__dirname, '../docs/examples-docs'),
- dist: path.resolve(__dirname, '../docs/examples-dist'),
- nav: docConfig,
- watch: !isProduction
-});
-
module.exports = {
entry: {
vendor: ['packages'],
@@ -89,15 +80,7 @@ module.exports = {
test: /\.md/,
loader: 'vue-markdown-loader',
options: {
- preventExtract: true,
- use: [[require('markdown-it-container'), 'demo']],
- preprocess(MarkdownIt, source) {
- const styleRegexp = /
diff --git a/docs/demos/views/address-edit.vue b/docs/demos/views/address-edit.vue
new file mode 100644
index 000000000..0e2e9e55c
--- /dev/null
+++ b/docs/demos/views/address-edit.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/address-list.vue b/docs/demos/views/address-list.vue
new file mode 100644
index 000000000..c6d56deb5
--- /dev/null
+++ b/docs/demos/views/address-list.vue
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/area.vue b/docs/demos/views/area.vue
new file mode 100644
index 000000000..35bd296d9
--- /dev/null
+++ b/docs/demos/views/area.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/badge.vue b/docs/demos/views/badge.vue
new file mode 100644
index 000000000..308c35e1a
--- /dev/null
+++ b/docs/demos/views/badge.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/button.vue b/docs/demos/views/button.vue
new file mode 100644
index 000000000..770553339
--- /dev/null
+++ b/docs/demos/views/button.vue
@@ -0,0 +1,92 @@
+
+
+
+ Default
+ Primary
+ Danger
+
+
+
+ Large
+ Normal
+ Small
+ Mini
+
+
+
+ Diabled
+
+
+
+
+
+
+
+
+
+ {{ $t('button') }}
+
+
+
+
+ {{ $t('button') }}
+
+
+
+ {{ $t('button') }}
+
+
+ {{ $t('button') }}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/card.vue b/docs/demos/views/card.vue
new file mode 100644
index 000000000..09892340c
--- /dev/null
+++ b/docs/demos/views/card.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+ {{ $t('button') }}
+ {{ $t('button') }}
+
+
+
+
+
+
+
diff --git a/docs/demos/views/cell-swipe.vue b/docs/demos/views/cell-swipe.vue
new file mode 100644
index 000000000..c12a759ef
--- /dev/null
+++ b/docs/demos/views/cell-swipe.vue
@@ -0,0 +1,51 @@
+
+
+
+
+ {{ $t('button1') }}
+
+
+
+ {{ $t('button2') }}
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/cell.vue b/docs/demos/views/cell.vue
new file mode 100644
index 000000000..8e4a3c9b8
--- /dev/null
+++ b/docs/demos/views/cell.vue
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('cell') }}
+ {{ $t('tag') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/checkbox.vue b/docs/demos/views/checkbox.vue
new file mode 100644
index 000000000..8ad87952a
--- /dev/null
+++ b/docs/demos/views/checkbox.vue
@@ -0,0 +1,77 @@
+
+
+
+ {{ $t('checkbox') }} 1
+
+
+
+ {{ $t('checkbox') }} 2
+
+
+
+
+
+ {{ $t('checkbox') }} {{ item }}
+
+
+
+
+
+
+
+
+ {{ $t('checkbox') }} {{ item }}
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/contact.vue b/docs/demos/views/contact.vue
new file mode 100644
index 000000000..0c17b6a0d
--- /dev/null
+++ b/docs/demos/views/contact.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/coupon.vue b/docs/demos/views/coupon.vue
new file mode 100644
index 000000000..698d06e4a
--- /dev/null
+++ b/docs/demos/views/coupon.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/datetime-picker.vue b/docs/demos/views/datetime-picker.vue
new file mode 100644
index 000000000..8cbe3b61f
--- /dev/null
+++ b/docs/demos/views/datetime-picker.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/dialog.vue b/docs/demos/views/dialog.vue
new file mode 100644
index 000000000..2f16fafe0
--- /dev/null
+++ b/docs/demos/views/dialog.vue
@@ -0,0 +1,60 @@
+
+
+
+ Alert
+ {{ $t('alert2') }}
+
+
+
+ Confirm
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/field.vue b/docs/demos/views/field.vue
new file mode 100644
index 000000000..f0c78ea46
--- /dev/null
+++ b/docs/demos/views/field.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/goods-action.vue b/docs/demos/views/goods-action.vue
new file mode 100644
index 000000000..c8a35efd3
--- /dev/null
+++ b/docs/demos/views/goods-action.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+ 客服
+
+
+ 购物车
+
+
+ 加入购物车
+
+
+ 立即购买
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/examples-docs/en-US/icon.md b/docs/demos/views/icon.vue
similarity index 57%
rename from docs/examples-docs/en-US/icon.md
rename to docs/demos/views/icon.vue
index de3855093..77e460683 100644
--- a/docs/examples-docs/en-US/icon.md
+++ b/docs/demos/views/icon.vue
@@ -1,6 +1,15 @@
-
-## Icon
+
diff --git a/docs/demos/views/image-preview.vue b/docs/demos/views/image-preview.vue
new file mode 100644
index 000000000..7e81eed84
--- /dev/null
+++ b/docs/demos/views/image-preview.vue
@@ -0,0 +1,51 @@
+
+
+
+ {{ $t('button1') }}
+
+
+
+ {{ $t('button2') }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/layout.vue b/docs/demos/views/layout.vue
new file mode 100644
index 000000000..ad4503374
--- /dev/null
+++ b/docs/demos/views/layout.vue
@@ -0,0 +1,65 @@
+
+
+
+
+ span: 8
+ span: 8
+ span: 8
+
+
+
+ span: 4
+ offset: 4, span: 10
+
+
+
+ offset: 12, span: 12
+
+
+
+
+
+ span: 8
+ span: 8
+ span: 8
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/lazyload.vue b/docs/demos/views/lazyload.vue
new file mode 100644
index 000000000..9a8a96fb7
--- /dev/null
+++ b/docs/demos/views/lazyload.vue
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/loading.vue b/docs/demos/views/loading.vue
new file mode 100644
index 000000000..2ce588f23
--- /dev/null
+++ b/docs/demos/views/loading.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/nav-bar.vue b/docs/demos/views/nav-bar.vue
new file mode 100644
index 000000000..adc2f58f5
--- /dev/null
+++ b/docs/demos/views/nav-bar.vue
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/notice-bar.vue b/docs/demos/views/notice-bar.vue
new file mode 100644
index 000000000..e37e3da34
--- /dev/null
+++ b/docs/demos/views/notice-bar.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/number-keyboard.vue b/docs/demos/views/number-keyboard.vue
new file mode 100644
index 000000000..ed0509869
--- /dev/null
+++ b/docs/demos/views/number-keyboard.vue
@@ -0,0 +1,59 @@
+
+
+
+
+ {{ $t('button1') }}
+
+
+
+ {{ $t('button2') }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/panel.vue b/docs/demos/views/panel.vue
new file mode 100644
index 000000000..86cbdea15
--- /dev/null
+++ b/docs/demos/views/panel.vue
@@ -0,0 +1,35 @@
+
+
+
+
+ {{ $t('content') }}
+
+
+
+
+
+ {{ $t('content') }}
+
+ {{ $t('button') }}
+ {{ $t('button') }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/password-input.vue b/docs/demos/views/password-input.vue
new file mode 100644
index 000000000..e5781f424
--- /dev/null
+++ b/docs/demos/views/password-input.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/picker.vue b/docs/demos/views/picker.vue
new file mode 100644
index 000000000..e9006595a
--- /dev/null
+++ b/docs/demos/views/picker.vue
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/popup.vue b/docs/demos/views/popup.vue
new file mode 100644
index 000000000..25ca51d89
--- /dev/null
+++ b/docs/demos/views/popup.vue
@@ -0,0 +1,112 @@
+
+
+
+ {{ $t('button1') }}
+ {{ $t('content') }}
+
+
+
+ {{ $t('button2') }}
+
+ {{ $t('button3') }}
+
+
+ {{ $t('button4') }}
+
+ {{ $t('content') }}
+
+
+ {{ $t('button5') }}
+
+ {{ $t('button6') }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/progress.vue b/docs/demos/views/progress.vue
new file mode 100644
index 000000000..5ab05dd8d
--- /dev/null
+++ b/docs/demos/views/progress.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/pull-refresh.vue b/docs/demos/views/pull-refresh.vue
new file mode 100644
index 000000000..0b3084ead
--- /dev/null
+++ b/docs/demos/views/pull-refresh.vue
@@ -0,0 +1,49 @@
+
+
+
+
+ {{ $t('text') }}: {{ count }}
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/radio.vue b/docs/demos/views/radio.vue
new file mode 100644
index 000000000..00e242c85
--- /dev/null
+++ b/docs/demos/views/radio.vue
@@ -0,0 +1,77 @@
+
+
+
+
+ {{ $t('radio') }} 1
+ {{ $t('radio') }} 2
+
+
+
+
+
+ {{ $t('text1') }}
+ {{ $t('text2') }}
+
+
+
+
+
+
+ {{ $t('radio') }} 1
+ {{ $t('radio') }} 2
+
+
+
+
+
+
+
+ {{ $t('radio') }}1
+ {{ $t('radio') }}2
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/search.vue b/docs/demos/views/search.vue
new file mode 100644
index 000000000..deb9c4aa2
--- /dev/null
+++ b/docs/demos/views/search.vue
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('search') }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/sku.vue b/docs/demos/views/sku.vue
new file mode 100644
index 000000000..763ae13ca
--- /dev/null
+++ b/docs/demos/views/sku.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+ 基础用法
+
+
+
+
+
+
+
+
+
+
+
+
+ 积分兑换
+
+
+
+ 买买买
+
+
+
+
+
自定义sku actions
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/stepper.vue b/docs/demos/views/stepper.vue
new file mode 100644
index 000000000..2890c2788
--- /dev/null
+++ b/docs/demos/views/stepper.vue
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/steps.vue b/docs/demos/views/steps.vue
new file mode 100644
index 000000000..c2dbe6089
--- /dev/null
+++ b/docs/demos/views/steps.vue
@@ -0,0 +1,113 @@
+
+
+
+
+ {{ $t('step1') }}
+ {{ $t('step2') }}
+ {{ $t('step3') }}
+ {{ $t('step4') }}
+
+
+ {{ $t('nextStep') }}
+
+
+
+
+ {{ $t('step1') }}
+ {{ $t('step2') }}
+ {{ $t('step3') }}
+ {{ $t('step4') }}
+
+
+
+
+
+
+ {{ $t('status1') }}
+ 2016-07-12 12:40
+
+
+ {{ $t('status2') }}
+ 2016-07-11 10:00
+
+
+ {{ $t('status3') }}
+ 2016-07-10 09:30
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/submit-bar.vue b/docs/demos/views/submit-bar.vue
new file mode 100644
index 000000000..335c8636b
--- /dev/null
+++ b/docs/demos/views/submit-bar.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 您的收货地址不支持同城送, 修改地址 >
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/swipe.vue b/docs/demos/views/swipe.vue
new file mode 100644
index 000000000..aafe36147
--- /dev/null
+++ b/docs/demos/views/swipe.vue
@@ -0,0 +1,80 @@
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/demos/views/switch-cell.vue b/docs/demos/views/switch-cell.vue
new file mode 100644
index 000000000..264901030
--- /dev/null
+++ b/docs/demos/views/switch-cell.vue
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/switch.vue b/docs/demos/views/switch.vue
new file mode 100644
index 000000000..da24b2206
--- /dev/null
+++ b/docs/demos/views/switch.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/tab.vue b/docs/demos/views/tab.vue
new file mode 100644
index 000000000..41d3da68b
--- /dev/null
+++ b/docs/demos/views/tab.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+ {{ $t('content') }} {{ index }}
+
+
+
+
+
+
+
+ {{ $t('content') }} {{ index }}
+
+
+
+
+
+
+
+ {{ $t('content') }} {{ index }}
+
+
+
+
+
+
+
+ {{ $t('content') }} {{ index }}
+
+
+
+
+
+
+
+ {{ $t('content') }} {{ index }}
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/tabbar.vue b/docs/demos/views/tabbar.vue
new file mode 100644
index 000000000..33b55c3b7
--- /dev/null
+++ b/docs/demos/views/tabbar.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ {{ $t('tab') }}
+ {{ $t('tab') }}
+ {{ $t('tab') }}
+ {{ $t('tab') }}
+
+
+
+
+
+
+ {{ $t('custom') }}
+
+
+ {{ $t('tab') }}
+ {{ $t('tab') }}
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/tag.vue b/docs/demos/views/tag.vue
new file mode 100644
index 000000000..85999b0ff
--- /dev/null
+++ b/docs/demos/views/tag.vue
@@ -0,0 +1,53 @@
+
+
+
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+
+
+
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+
+
+
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+ {{ $t('tag') }}
+
+
+
+
+
+
+
diff --git a/docs/demos/views/toast.vue b/docs/demos/views/toast.vue
new file mode 100644
index 000000000..61d58208f
--- /dev/null
+++ b/docs/demos/views/toast.vue
@@ -0,0 +1,95 @@
+
+
+
+ {{ $t('title1') }}
+
+
+
+ {{ $t('title2') }}
+
+
+
+ {{ $t('success') }}
+ {{ $t('fail') }}
+
+
+
+ {{ $t('advancedUsage') }}
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/tree-select.vue b/docs/demos/views/tree-select.vue
new file mode 100644
index 000000000..3cfcc2566
--- /dev/null
+++ b/docs/demos/views/tree-select.vue
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/uploader.vue b/docs/demos/views/uploader.vue
new file mode 100644
index 000000000..15b972f15
--- /dev/null
+++ b/docs/demos/views/uploader.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/demos/views/waterfall.vue b/docs/demos/views/waterfall.vue
new file mode 100644
index 000000000..965895c3a
--- /dev/null
+++ b/docs/demos/views/waterfall.vue
@@ -0,0 +1,77 @@
+
+
+
+ {{ $t('text') }}
+
+
+
+
+
+
+
+
+
diff --git a/docs/examples-docs/en-US/dialog.md b/docs/examples-docs/en-US/dialog.md
deleted file mode 100644
index 97f8d5ac6..000000000
--- a/docs/examples-docs/en-US/dialog.md
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-## Dialog
-
-### Install
-
-```js
-import { Dialog } from 'vant';
-```
-
-### Usage
-
-#### Alert dialog
-Used to prompt for some messages, only including one confirm button
-
-:::demo Alert dialog
-```html
-Alert
-Alert without title
-```
-
-```javascript
-export default {
- methods: {
- onClickAlert() {
- Dialog.alert({
- title: 'Title',
- message: 'Content'
- }).then(() => {
- // on close
- });
- },
-
- onClickAlert2() {
- Dialog.alert({
- message: 'Content'
- }).then(() => {
- // on close
- });
- }
- }
-};
-```
-:::
-
-#### Confirm dialog
-Used to confirm some messages, including a confirm button and a cancel button
-
-:::demo Confirm dialog
-```html
-Confirm
-```
-
-```javascript
-export default {
- methods: {
- onClickConfirm() {
- Dialog.confirm({
- title: 'Title',
- message: 'Content'
- }).then(() => {
- // on confirm
- }).catch(() => {
- // on cancel
- });
- }
- }
-};
-```
-:::
-
-### Methods
-
-| Name | Attribute | Return value | Description |
-|-----------|-----------|-----------|-------------|
-| Dialog.alert | options | `Promise` | Show alert dialog |
-| Dialog.confirm | options | `Promise` | Show confim dialog |
-| Dialog.close | - | `void` | Close dialog |
-
-### Options
-
-| Attribute | Description | Type | Default | Accepted Values |
-|-----------|-----------|-----------|-------------|-------------|
-| title | Title | `String` | - | - |
-| message | Message | `String` | - | - |
-| showConfirmButton | Whether to show confirm button | `Boolean` | `true` | - |
-| showCancelButton | Whether to show cancel button | `Boolean` | `false` | - |
-| confirmButtonText | Confirm button text | `String` | `确认` | - |
-| cancelButtonText | Cancel button test | `String` | `取消` | - |
-| overlay | Whether to show overlay | `Boolean` | `true` | - |
-| closeOnClickOverlay | Whether to close when click overlay | `Boolean` | `false` | - |
-| lockOnScroll | Whether to lock body scroll | `Boolean` | `true` | - |
diff --git a/docs/examples-docs/en-US/image-preview.md b/docs/examples-docs/en-US/image-preview.md
deleted file mode 100644
index 57f011080..000000000
--- a/docs/examples-docs/en-US/image-preview.md
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-## ImagePreview
-
-### Install
-
-```js
-import { ImagePreview } from 'vant';
-```
-
-### Usage
-
-#### Basic Usage
-
-:::demo Basic Usage
-```html
-Show
-```
-
-```javascript
-export default {
- methods: {
- showImagePreview() {
- ImagePreview([
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]);
- }
- }
-};
-```
-:::
-
-### Arguments
-
-| Attribute | Description | Type |
-|-----------|-----------|-----------|
-| imageUrls | Image URL list | `Array` |
diff --git a/docs/examples-docs/en-US/popup.md b/docs/examples-docs/en-US/popup.md
deleted file mode 100644
index 0c3e42158..000000000
--- a/docs/examples-docs/en-US/popup.md
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-## Popup
-
-### Install
-``` javascript
-import { Popup } from 'vant';
-
-Vue.component(Popup.name, Popup);
-```
-
-### Usage
-
-#### Basic Usage
-Popup is located in the middle of the screen by default
-
-:::demo Basic Usage
-```html
-Show Popup
-Content
-```
-
-```javascript
-export default {
- data() {
- return {
- show1: false
- }
- }
-};
-```
-:::
-
-#### Different Position
-Use `position` prop to set popup display position
-
-:::demo Different Position
-```html
-From Bottom
-
- Show Dialog
-
-
-From Top
-Content
-
-From Right
-
- Close
-
-```
-
-```javascript
-export default {
- data() {
- return {
- show1: false,
- show2: false,
- show3: false,
- show4: false
- }
- },
-
- watch: {
- show2(val) {
- if (val) {
- setTimeout(() => {
- this.show2 = false;
- }, 2000);
- }
- }
- }
-};
-```
-:::
-
-### API
-
-| Attribute | Description | Type | Default | Accepted Values |
-|-----------|-----------|-----------|-------------|-------------|
-| v-model | Whether to show popup | `Boolean` | `false` | - |
-| overlay | Whether to show overlay | `Boolean` | `true` | - |
-| lockOnScroll | Lock body scroll | `Boolean` | `false` | - |
-| position | Position | `String` | - | `top` `bottom` `right` `left` |
-| closeOnClickOverlay | Close popup when click overlay | `Boolean` | `true` | - |
-| transition | Transition | `String` | `popup-slide` | - |
-| preventScroll | Prevent background scroll | `Boolean` | `false` | - |
diff --git a/docs/examples-docs/en-US/tab.md b/docs/examples-docs/en-US/tab.md
deleted file mode 100644
index bfa597b0a..000000000
--- a/docs/examples-docs/en-US/tab.md
+++ /dev/null
@@ -1,339 +0,0 @@
-
-
-
-
-## Tabs
-
-### Install
-``` javascript
-import { Tab, Tabs } from 'vant';
-
-Vue.component(Tab.name, Tab);
-Vue.component(Tabs.name, Tabs);
-```
-
-### Usage
-
-#### Basic Usage
-
-By default, the first tab is actived.
-
-:::demo Basic Usage
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-```
-:::
-
-#### Active Specified tab
-
-You can set `active` attribute on `van-tabs` to active specified tab.
-
-:::demo Active Specified tab
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-
-
-```
-:::
-
-#### Tab duration time
-
-You can use `duration` attribute to set tab duration time, the default time is `0.3s`.
-
-:::demo Tab duration time
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-```
-:::
-
-#### Swipe Tabs
-
-By default more than 4 tabs, you can scroll through the tabs. You can set `swipeThreshold` attribute to customize threshold number.
-
-:::demo Swipe Tabs
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
- content of tab 5
-
-
- content of tab 6
-
-
- content of tab 7
-
-
- content of tab 8
-
-
-```
-:::
-
-#### Disabled Tab
-
-You can set `disabled` attribute on the corresponding `van-tab`.
-
-:::demo Disabled Tab
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-```
-
-```javascript
-export default {
- methods: {
- onClickDisabled() {
- Toast('Disabled!');
- }
- }
-};
-```
-:::
-
-#### Card Style
-
-Tabs styled as cards.
-
-:::demo Card Style
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-```
-:::
-
-
-#### Custom Style
-
-You can set `css class` to customize tabs style.
-
-:::demo Custom Style
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-
-
-```
-:::
-
-#### Click Event
-
-You can bind `click` event on `van-tabs`, the event handler function has one parameters: index of click tab.
-
-:::demo Click Event
-```html
-
-
- content of tab 1
-
-
- content of tab 2
-
-
- content of tab 3
-
-
- content of tab 4
-
-
-```
-
-```javascript
-export default {
- methods: {
- handleTabClick(index) {
- alert(index);
- }
- }
-};
-```
-:::
-
-### van-tabs API
-
-| Attribute | Description | Type | Default | Accepted Values |
-|-----------|-----------|-----------|-------------|-------------|
-| type | There are two style tabs, set this attribute to change tab style | `String` | `line` | `line`, `card` |
-| active | Index of active tab | `String`, `Number` | `0` | - |
-| duration | Toggle tab's animation time | `Number` | `0.3` | - | - |
-| swipeThreshold | Set swipe tabs threshold | `Number` | `4` | - | - |
-
-### van-tab API
-
-| Attribute | Description | Type | Default | Accepted Values |
-|-----------|-----------|-----------|-------------|-------------|
-| title | Tab title | `String` | - | - |
-| disabled | Whether disabled current tab | `Boolean` | `false` | - |
-
-### van-tabs Event
-
-| Event | Description | Attribute |
-|-----------|-----------|-----------|
-| click | Triggered when click tab | index:index of current tab |
-| disabled | Triggered when click disabled tab | index:index of current tab |
-
diff --git a/docs/examples-docs/en-US/toast.md b/docs/examples-docs/en-US/toast.md
deleted file mode 100644
index ad04c3db1..000000000
--- a/docs/examples-docs/en-US/toast.md
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-## Toast
-
-### Install
-
-```javascript
-import { Toast } from 'vant';
-```
-
-### Usage
-
-#### Text
-
-:::demo Text
-```html
-Show Text
-```
-
-```javascript
-export default {
- methods: {
- showToast() {
- Toast('Some messages');
- }
- }
-}
-```
-:::
-
-#### Loading
-
-:::demo Loading
-```html
-Show Loading
-```
-
-```javascript
-export default {
- methods: {
- showLoadingToast() {
- Toast.loading({ mask: true });
- }
- }
-}
-```
-:::
-
-#### Success/Fail
-
-:::demo Success/Fail
-```html
-Show Success
-Show Fail
-```
-
-```javascript
-export default {
- methods: {
- showSuccessToast() {
- Toast.success('Success');
- },
- showFailToast() {
- Toast.fail('Fail');
- }
- }
-}
-```
-:::
-
-#### Advanced Usage
-
-:::demo Advanced Usage
-```html
-Advanced Usage
-```
-
-```javascript
-export default {
- methods: {
- showCustomizedToast() {
- const toast = Toast.loading({
- duration: 0, // continuous display toast
- forbidClick: true, // forbid click background
- message: '3 seconds'
- });
-
- let second = 3;
- const timer = setInterval(() => {
- second--;
- if (second) {
- toast.message = `${second} seconds`;
- } else {
- clearInterval(timer);
- Toast.clear();
- }
- }, 1000);
- }
- }
-};
-```
-:::
-
-### Methods
-
-| Methods | Attribute | Return value | Description |
-|-----------|-----------|-----------|-------------|
-| Toast | `options | message` | toast instance | Show toast |
-| Toast.loading | `options | message` | toast instance | Show loading toast |
-| Toast.success | `options | message` | toast instance | Show success toast |
-| Toast.fail | `options | message` | toast instance | Show fail toast |
-| Toast.clear | - | `void` | Close |
-
-### Options
-
-| Attribute | Description | Type | Default | Accepted Values |
-|-----------|-----------|-----------|-------------|-------------|
-| type | Type | `String` | `text` | `loading` `success` `fail` `html` |
-| message | Message | `String` | `''` | - |
-| position | Position | `String` | `middle` | `top` `bottom` |
-| mask | Whether to show mask | `Boolean` | `false` | - |
-| forbidClick | Whether to forbid click background | `Boolean` | `false` | - |
-| duration | Toast duration(ms) | `Number` | `3000` | Toast won't disappear if value is 0 |
diff --git a/docs/examples-docs/en-US/uploader.md b/docs/examples-docs/en-US/uploader.md
deleted file mode 100644
index 635adaf3a..000000000
--- a/docs/examples-docs/en-US/uploader.md
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-## Uploader
-
-### Install
-``` javascript
-import { Uploader } from 'vant';
-
-Vue.component(Uploader.name, Uploader);
-```
-
-### Usage
-
-#### Basic Usage
-
-:::demo Basic Usage
-```html
-
-
-
-
-
-```
-
-```javascript
-export default {
- methods: {
- logContent(file) {
- console.log(file)
- }
- }
-};
-```
-:::
-
-### API
-
-| Attribute | Description | Type | Default | Accepted Values |
-|-----------|-----------|-----------|-------------|-------------|
-| resultType | 读取文件的方式,以base64的方式读取;以文本的方式读取 | `String` | `dataUrl` | `text` |
-| disable | 是否禁用上传,在图片上传期间设置为true,禁止用户点击此组件上传图片 | `Boolean` | `false` | - |
-| beforeRead | 读文件之前的钩子,参数为选择的文件,若返回 false 则停止读取文件 | `Function` | - | - |
-| afterRead | 文件读完之后回调此函数,参数为 { file:'选择的文件',content:'读的内容' } | `Function` | - | - |
-
-### Slot
-
-| name | Description |
-|-----------|-----------|
-| - | 自定义上传显示图标 |
diff --git a/docs/examples-docs/zh-CN/actionsheet.md b/docs/examples-docs/zh-CN/actionsheet.md
deleted file mode 100644
index 7c8af18d4..000000000
--- a/docs/examples-docs/zh-CN/actionsheet.md
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-
-
-## Actionsheet 行动按钮
-
-### 使用指南
-``` javascript
-import { Actionsheet } from 'vant';
-
-Vue.component(Actionsheet.name, Actionsheet);
-```
-
-### 代码演示
-
-#### 基础用法
-需要传入一个`actions`的数组,数组的每一项是一个对象,对象属性见文档下方表格。
-
-:::demo 基础用法
-```html
-弹出 Actionsheet
-
-```
-
-```javascript
-export default {
- data() {
- return {
- show1: false,
- actions: [
- {
- name: '微信安全支付',
- className: 'actionsheet-wx',
- callback: this.onClick
- },
- {
- name: '支付宝支付',
- loading: true
- },
- {
- name: '信用卡支付'
- },
- {
- name: '其他支付方式'
- }
- ]
- };
- },
-
- methods: {
- onClick(item) {
- Toast(item.name);
- }
- }
-}
-```
-:::
-
-#### 带取消按钮的 Actionsheet
-
-如果传入了`cancelText`属性,且不为空,则会在下方显示一个取消按钮,点击会将当前`Actionsheet`关闭。
-
-:::demo 带取消按钮的 Actionsheet
-```html
-弹出带取消按钮的 Actionsheet
-
-
-```
-
-```javascript
-export default {
- data() {
- return {
- show2: false,
- actions: [
- {
- name: '微信安全支付',
- className: 'actionsheet-wx',
- callback: this.onClick
- },
- {
- name: '支付宝支付',
- loading: true
- },
- {
- name: '信用卡支付'
- },
- {
- name: '其他支付方式'
- }
- ]
- };
- }
-}
-```
-:::
-
-#### 带标题的 Actionsheet
-
-如果传入了`title`属性,且不为空,则另外一种样式的`Actionsheet`,里面内容需要自定义。
-
-:::demo 带标题的 Actionsheet
-```html
-弹出带标题的 Actionsheet
-
- 一些内容
-
-```
-:::
-
-### API
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| actions | 行动按钮数组 | `Array` | `[]` | - |
-| title | 标题 | `String` | - | - |
-| cancelText | 取消按钮文案 | `String` | - | - |
-| overlay | 是否显示遮罩 | `Boolean` | - | - |
-| closeOnClickOverlay | 点击遮罩是否关闭`Actionsheet` | `Boolean` | - | - |
-
-### actions
-
-
-`API`中的`actions`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`:
-
-| key | 说明 |
-|-----------|-----------|
-| name | 标题 |
-| subname | 二级标题 |
-| className | 为对应列添加特殊的`class` |
-| loading | 是否是`loading`状态 |
-| callback | 点击时的回调。该回调接受一个参数,参数为当前点击`action`的对象信息 |
diff --git a/docs/examples-docs/zh-CN/dialog.md b/docs/examples-docs/zh-CN/dialog.md
deleted file mode 100644
index d549a9169..000000000
--- a/docs/examples-docs/zh-CN/dialog.md
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-## Dialog 弹出框
-
-### 使用指南
-
-```js
-import { Dialog } from 'vant';
-```
-
-### 代码演示
-
-#### 消息提示
-
-用于提示一些消息,只包含一个确认按钮
-
-:::demo 消息提示
-```html
-Alert
-无标题 Alert
-```
-
-```javascript
-export default {
- methods: {
- onClickAlert() {
- Dialog.alert({
- title: '标题',
- message: '弹窗内容'
- }).then(() => {
- // on close
- });
- },
-
- onClickAlert2() {
- Dialog.alert({
- message: '弹窗内容'
- }).then(() => {
- // on close
- });
- }
- }
-};
-```
-:::
-
-#### 消息确认
-
-用于确认消息,包含取消和确认按钮
-
-:::demo 消息确认
-```html
-Confirm
-```
-
-```javascript
-export default {
- methods: {
- onClickConfirm() {
- Dialog.confirm({
- title: '标题',
- message: '弹窗内容'
- }).then(() => {
- // on confirm
- }).catch(() => {
- // on cancel
- });
- }
- }
-};
-```
-:::
-
-### 方法
-
-| 方法名 | 参数 | 返回值 | 介绍 |
-|-----------|-----------|-----------|-------------|
-| Dialog.alert | options | `Promise` | 展示消息提示弹窗 |
-| Dialog.confirm | options | `Promise` | 展示消息确认弹窗 |
-| Dialog.close | - | `void` | 关闭弹窗 |
-
-### Options
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| title | 标题 | `String` | - | - |
-| message | 内容 | `String` | - | - |
-| showConfirmButton | 是否展示确认按钮 | `Boolean` | `true` | - |
-| showCancelButton | 是否展示取消按钮 | `Boolean` | `false` | - |
-| confirmButtonText | 确认按钮的文案 | `String` | `确认` | - |
-| cancelButtonText | 取消按钮的文案 | `String` | `取消` | - |
-| overlay | 是否展示蒙层 | `Boolean` | `true` | - |
-| closeOnClickOverlay | 点击蒙层时是否关闭弹窗 | `Boolean` | `false` | - |
-| lockOnScroll | 是否禁用背景滚动 | `Boolean` | `true` | - |
diff --git a/docs/examples-docs/zh-CN/icon.md b/docs/examples-docs/zh-CN/icon.md
deleted file mode 100644
index 885a9dbcb..000000000
--- a/docs/examples-docs/zh-CN/icon.md
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
-
-## Icon 图标
-
-### 使用指南
-``` javascript
-import { Icon } from 'vant';
-
-Vue.component(Icon.name, Icon);
-```
-
-### 代码演示
-
-#### 基础用法
-
-设置`name`属性为对应的图标名称即可,所有可用的图标名称见右侧列表
-:::demo 图标列表
-```html
-
-```
-:::
-
-### API
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| name | icon名称 | `String` | `''` | - |
diff --git a/docs/examples-docs/zh-CN/image-preview.md b/docs/examples-docs/zh-CN/image-preview.md
deleted file mode 100644
index bc16e3fa4..000000000
--- a/docs/examples-docs/zh-CN/image-preview.md
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-## ImagePreview 图片预览
-
-### 使用指南
-
-`ImagePreview`和其他组件不同,不是通过HTML结构的方式来使用,而是通过函数调用的方式。使用前需要先引入它。
-
-```js
-import { ImagePreview } from 'vant';
-```
-
-### 代码演示
-
-#### 基础用法
-
-:::demo 基础用法
-```html
-预览图片
-```
-
-```javascript
-export default {
- methods: {
- showImagePreview() {
- ImagePreview([
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]);
- }
- }
-};
-```
-:::
-
-#### 指定初始位置
-
-:::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/docs/examples-docs/zh-CN/lazyload.md b/docs/examples-docs/zh-CN/lazyload.md
deleted file mode 100644
index 97c266bd9..000000000
--- a/docs/examples-docs/zh-CN/lazyload.md
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
-## Lazyload 图片懒加载
-
-### 使用指南
-
-`Lazyload`是`Vue`指令,所以需要使用它必须将它注册到`Vue`的指令中。
-
-```js
-import Vue from 'vue';
-import { Lazyload } from 'vant';
-
-Vue.use(Lazyload, options);
-```
-
-### 代码演示
-
-#### 基础用法
-将`v-lazy`指令的值设置为你需要懒加载的图片
-
-:::demo 基础用法
-```html
-
-```
-
-```javascript
-export default {
- data() {
- return {
- imageList: [
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]
- };
- }
-}
-```
-:::
-
-#### 背景图懒加载
-
-和图片懒加载不同,背景图懒加载需要使用`v-lazy:background-image`,值设置为背景图片的地址,需要注意的是必须声明容器高度。
-
-:::demo 背景图懒加载
-```html
-
-```
-
-```javascript
-export default {
- data() {
- return {
- backgroundImageList: [
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]
- };
- }
-}
-```
-:::
-
-#### 懒加载模块
-
-懒加载模块需要使用到`lazy-component`,将需要懒加载的内容放在`lazy-component`中即可。
-
-:::demo 懒加载模块
-```html
-
-
-
-```
-
-```javascript
-export default {
- data() {
- return {
- componentImageList: [
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]
- };
- }
-}
-```
-:::
-
-### Options
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| loading | 加载时的图片 | `String` | - | - |
-| error | 错误时的图片 | `String` | - | - |
-| preload | 预加载高度的比例 | `String` | - | - |
-| attempt | 尝试次数 | `Number` | `3` | - |
-| listenEvents | 监听的事件 | `Array` | `scroll`等 | - |
-| adapter | 适配器 | `Object` | - | - |
-| filter | 图片url过滤 | `Object` | - | - |
-| lazyComponent | 是否能懒加载模块 | `Boolean` | `false` | - |
-
-更多内容请参照:[ vue-lazyload 官方文档](https://github.com/hilongjw/vue-lazyload)
diff --git a/docs/examples-docs/zh-CN/loading.md b/docs/examples-docs/zh-CN/loading.md
deleted file mode 100644
index 1df7f40b9..000000000
--- a/docs/examples-docs/zh-CN/loading.md
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-## Loading 加载
-
-### 使用指南
-``` javascript
-import { Loading } from 'vant';
-
-Vue.component(Loading.name, Loading);
-```
-
-### 代码演示
-
-#### 单色圆环
-
-:::demo 单色圆环
-```html
-
-
-```
-:::
-
-#### 渐变色圆环
-
-:::demo 渐变色圆环
-```html
-
-
-```
-:::
-
-#### Spinner
-
-:::demo Spinner
-```html
-
-
-```
-:::
-
-### API
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| color | 颜色 | `String` | `black` | `black` `white` |
-| type | 类型 | `String` | `gradient-circle` | `spinner` `circle` |
diff --git a/docs/examples-docs/zh-CN/popup.md b/docs/examples-docs/zh-CN/popup.md
deleted file mode 100644
index 187725895..000000000
--- a/docs/examples-docs/zh-CN/popup.md
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-
-## Popup 弹出层
-
-### 使用指南
-``` javascript
-import { Popup } from 'vant';
-
-Vue.component(Popup.name, Popup);
-```
-
-### 代码演示
-
-#### 基础用法
-`popup`默认从中间弹出
-
-:::demo 基础用法
-```html
-弹出 Popup
-内容
-```
-
-```javascript
-export default {
- data() {
- return {
- show1: false
- }
- }
-};
-```
-:::
-
-#### 弹出位置
-通过`position`属性设置 Popup 弹出位置
-
-:::demo 弹出位置
-```html
-底部弹出
-
- 弹出 Dialog
-
-
-顶部弹出
-
- 更新成功
-
-
-右侧弹出
-
- 关闭弹层
-
-```
-
-```javascript
-export default {
- data() {
- return {
- show1: false,
- show2: false,
- show3: false
- }
- },
-
- watch: {
- show2(val) {
- if (val) {
- setTimeout(() => {
- this.show2 = false;
- }, 2000);
- }
- }
- }
-};
-```
-:::
-
-### API
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| v-model | 当前组件是否显示 | `Boolean` | `false` | - |
-| overlay | 是否显示背景遮罩层 | `Boolean` | `true` | - |
-| lockOnScroll | 背景是否跟随滚动 | `Boolean` | `false` | - |
-| position | 弹出层位置 | `String` | - | `top` `bottom` `right` `left` |
-| closeOnClickOverlay | 点击遮罩层是否关闭弹出层 | `Boolean` | `true` | - |
-| transition | 弹出层的`transition` | `String` | `popup-slide` | - |
-| preventScroll | 是否防止滚动穿透 | `Boolean` | `false` | - |
diff --git a/docs/examples-docs/zh-CN/tab.md b/docs/examples-docs/zh-CN/tab.md
deleted file mode 100644
index ee4c35a5d..000000000
--- a/docs/examples-docs/zh-CN/tab.md
+++ /dev/null
@@ -1,257 +0,0 @@
-
-
-
-
-## Tabs 标签页
-
-### 使用指南
-``` javascript
-import { Tab, Tabs } from 'vant';
-
-Vue.component(Tab.name, Tab);
-Vue.component(Tabs.name, Tabs);
-```
-
-### 代码演示
-
-#### 基础用法
-
-默认情况下是启用第一个`tab`。
-
-:::demo 基础用法
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
-
-```
-:::
-
-#### active特定tab
-
-可以在`van-tabs`上设置`active`为对应`tab`的索引(从0开始,即0代表第一个)即可激活对应`tab`,默认为0。
-
-:::demo 基础用法
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
-
-```
-:::
-
-#### 设置切换tab的动画时间
-
-通过设置`duration`来指定时间,默认为0.3s,只接受`Number`类型参数。
-
-:::demo 设置切换tab的动画时间
-```html
-
- 内容一
- 内容二
- 内容三
-
-```
-:::
-
-#### 横向滚动tab
-
-默认情况下多于4个tab时,可以横向滚动tab。可以通过设置`swipeThreshold`这个阙值,多于这个阙值时,tab就会支持横向滚动。
-
-:::demo 横向滚动tab
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
- 内容五
- 内容六
- 内容七
- 内容八
-
-```
-:::
-
-#### 禁用tab
-
-在对应的`van-tab`上设置`disabled`属性即可。如果需要监听禁用事件,可以在`van-tabs`上监听`disabled`事件。
-
-:::demo 禁用tab
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
-
-```
-
-```javascript
-export default {
- methods: {
- onClickDisabled() {
- Toast('Disabled!')
- }
- }
-};
-```
-:::
-
-#### card样式
-
-`Tabs`目前有两种样式:`line`和`card`,默认为`line`样式,也就上面基础用法中的样式,你可以在`van-tabs`上设置`type`为`card`改为card样式。
-
-:::demo card样式
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
-
-```
-:::
-
-
-#### 自定义样式
-
-可以在`van-tabs`上设置对应的`class`,从而自定义某些样式。
-
-:::demo 自定义样式
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
-
-
-
-```
-:::
-
-#### click事件
-
-可以在`van-tabs`上绑定一个`click`事件,事件处理函数有一个参数,参数为对应`tab`在`tabs`中的索引。
-
-:::demo click事件
-```html
-
- 内容一
- 内容二
- 内容三
- 内容四
-
-```
-
-```javascript
-export default {
- methods: {
- handleTabClick(index) {
- alert(index);
- }
- }
-};
-```
-:::
-
-### van-tabs API
-
-| 参数 | 说明 | 类型 | 默认值 | 可选 |
-|-----------|-----------|-----------|-------------|-------------|
-| type | 两种UI | `String` | `line` | `line`, `card` |
-| active | 默认激活的tab | `String`, `Number` | `0` | - |
-| duration | 切换tab的动画时间 | `Number` | `0.3` | - | - |
-| swipeThreshold | 滚动阀值,默认是超过4个tab时标签页可滚动,通过这个属性可以设置超过多少个可滚动 | `Number` | `4` | - | - |
-
-
-### van-tab API
-
-| 参数 | 说明 | 类型 | 默认值 | 可选 |
-|-----------|-----------|-----------|-------------|-------------|
-| title | tab的标题 | `String` | - | - |
-| disabled | 是否禁用这个tab | `Boolean` | `false` | - |
-
-### van-tabs Event
-
-| 事件名 | 说明 | 参数 |
-|-----------|-----------|-----------|
-| click | 某个tab点击事件 | index:点击的`tab`的索引 |
-| disabled | 某个tab禁用时点击事件 | index:点击的`tab`的索引 |
-
diff --git a/docs/examples-docs/zh-CN/toast.md b/docs/examples-docs/zh-CN/toast.md
deleted file mode 100644
index c25158576..000000000
--- a/docs/examples-docs/zh-CN/toast.md
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-
-
-## Toast 轻提示
-
-### 使用指南
-
-```javascript
-import { Toast } from 'vant';
-```
-
-### 代码演示
-
-#### 文字提示
-
-:::demo 文字提示
-```html
-文字提示
-```
-
-```javascript
-export default {
- methods: {
- showToast() {
- Toast('我是提示文案,建议不超过十五字~');
- }
- }
-}
-```
-:::
-
-#### 加载提示
-
-:::demo 加载提示
-```html
-加载提示
-```
-
-```javascript
-export default {
- methods: {
- showLoadingToast() {
- Toast.loading({ mask: true });
- }
- }
-}
-```
-:::
-
-#### 成功/失败提示
-
-:::demo 成功/失败提示
-```html
-成功提示
-失败提示
-```
-
-```javascript
-export default {
- methods: {
- showSuccessToast() {
- Toast.success('成功文案');
- },
- showFailToast() {
- Toast.fail('失败文案');
- }
- }
-}
-```
-:::
-
-#### 高级用法
-
-:::demo 高级用法
-```html
-高级用法
-```
-
-```javascript
-export default {
- methods: {
- showCustomizedToast() {
- const toast = Toast.loading({
- duration: 0, // 持续展示 toast
- forbidClick: true, // 禁用背景点击
- message: '倒计时 3 秒'
- });
-
- let second = 3;
- const timer = setInterval(() => {
- second--;
- if (second) {
- toast.message = `倒计时 ${second} 秒`;
- } else {
- clearInterval(timer);
- Toast.clear();
- }
- }, 1000);
- }
- }
-};
-```
-:::
-
-### 方法
-
-| 方法名 | 参数 | 返回值 | 介绍 |
-|-----------|-----------|-----------|-------------|
-| Toast | `options | message` | toast 实例 | 展示提示 |
-| Toast.loading | `options | message` | toast 实例 | 展示加载提示 |
-| Toast.success | `options | message` | toast 实例 | 展示成功提示 |
-| Toast.fail | `options | message` | toast 实例 | 展示失败提示 |
-| Toast.clear | - | `void` | 关闭提示 |
-
-### Options
-
-| 参数 | 说明 | 类型 | 默认值 | 可选值 |
-|-----------|-----------|-----------|-------------|-------------|
-| type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` |
-| message | 内容 | `String` | `''` | - |
-| position | 位置 | `String` | `middle` | `top` `bottom` |
-| mask | 是否显示背景蒙层 | `Boolean` | `false` | - |
-| forbidClick | 禁止背景点击 | `Boolean` | `false` | - |
-| duration | 时长(ms) | `Number` | `3000` | 值为 0 时,toast 不会消失 |
diff --git a/docs/examples-docs/en-US/actionsheet.md b/docs/markdown/en-US/actionsheet.md
similarity index 59%
rename from docs/examples-docs/en-US/actionsheet.md
rename to docs/markdown/en-US/actionsheet.md
index 987efa494..401663348 100644
--- a/docs/examples-docs/en-US/actionsheet.md
+++ b/docs/markdown/en-US/actionsheet.md
@@ -1,28 +1,3 @@
-
-
## Actionsheet
### Install
@@ -37,17 +12,15 @@ Vue.component(Actionsheet.name, Actionsheet);
#### Basic Usage
Use `actions` prop to set options of actionsheet.
-:::demo Basic Usage
```html
-Show Actionsheet
-
+
```
```javascript
export default {
data() {
return {
- show1: false,
+ show: false,
actions: [
{ name: 'Option1', callback: this.onClick },
{ name: 'Option2' },
@@ -63,28 +36,21 @@ export default {
}
}
```
-:::
#### Actionsheet with cancel button
-:::demo Actionsheet with cancel button
```html
-Show Actionsheet with cancel button
-
+
```
-:::
#### Actionsheet with title
Actionsheet will get another style if there is a `title` prop.
-:::demo Actionsheet with title
```html
-Show Actionsheet with title
-
+
Content
```
-:::
### API
diff --git a/docs/examples-docs/en-US/address-edit.md b/docs/markdown/en-US/address-edit.md
similarity index 75%
rename from docs/examples-docs/en-US/address-edit.md
rename to docs/markdown/en-US/address-edit.md
index b07d00cd4..5b7dda5e8 100644
--- a/docs/examples-docs/en-US/address-edit.md
+++ b/docs/markdown/en-US/address-edit.md
@@ -1,41 +1,3 @@
-
-
## AddressEdit
### Install
@@ -49,14 +11,14 @@ Vue.component(AddressEdit.name, AddressEdit);
#### Basic Usage
-:::demo Basic Usage
+
```html
-import { Toast } from 'packages';
-
-export default {
- data() {
- return {
- chosenAddressId: '1',
- list: [
- {
- id: '1',
- name: '张三',
- tel: '13000000000',
- address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室'
- },
- {
- id: '2',
- name: '李四',
- tel: '1310000000',
- address: '浙江省杭州市拱墅区莫干山路 50 号'
- },
- {
- id: '3',
- name: '王五',
- tel: '1320000000',
- address: '浙江省杭州市滨江区江南大道 15 号'
- }
- ]
- }
- },
-
- methods: {
- onAdd() {
- Toast('新增收货地址');
- },
- onEdit(item, index) {
- Toast('编辑收货地址:' + index);
- }
- }
-}
-
-
## AddressList
### Install
@@ -52,7 +11,6 @@ Vue.component(AddressList.name, AddressList);
#### Basic Usage
-:::demo Basic Usage
```html
-import AreaList from '../../mock/area.json';
-
-export default {
- data() {
- return {
- areaList: AreaList
- }
- }
-};
-
-
## Area
### Install
@@ -26,43 +14,26 @@ Vue.component(Area.name, Area);
要初始化一个`Area`组件,你需要传入一个`areaList`属性,`areaList`Data Structure具体可看下面Data Structure章节。
-:::demo Basic Usage
```html
-
-
-
+
```
-:::
-#### 选中省市县
+#### Initial Value
如果想选中某个省市县,需要传入一个`value`属性,绑定对应的省市县`code`。
-:::demo 选中省市县
```html
-
+
```
-:::
-#### 配置显示列
+#### Columns Number
可以通过`columnsNum`属性配置省市县显示的列数,默认情况下会显示省市县,当你设置为`2`,则只会显示省市选择。
-:::demo 配置显示列
```html
-
+
```
-:::
+
### API
@@ -115,7 +86,7 @@ export default {
}
```
-完整数据见 [Area.json](https://github.com/youzan/vant/blob/dev/docs/mock/area.json)
+完整数据见 [Area.json](https://github.com/youzan/vant/blob/dev/docs/demos/mock/area.json)
#### 点击完成时返回的Data Structure
返回的数据整体为一个数组,数组内包含 `columnsNum` 个数据, 每个数据对应一列选项中被选中的数据。
diff --git a/docs/examples-docs/en-US/badge.md b/docs/markdown/en-US/badge.md
similarity index 74%
rename from docs/examples-docs/en-US/badge.md
rename to docs/markdown/en-US/badge.md
index 2429ed5c5..1c4e56b17 100644
--- a/docs/examples-docs/en-US/badge.md
+++ b/docs/markdown/en-US/badge.md
@@ -1,18 +1,3 @@
-
-
## Badge
### Install
@@ -25,11 +10,10 @@ Vue.component(Badge.name, Badge);
### Usage
#### Basic Usage
-Use `active-key` prop to set index of chosen 'badge'
+Use `activeKey` prop to set index of chosen 'badge'
-:::demo Basic Usage
```html
-
+
@@ -51,13 +35,12 @@ export default {
}
};
```
-:::
### BadgeGroup API
| Attribute | Description | Type | Default | Accepted Values |
|-----------|-----------|-----------|-------------|-------------|
-| active-key | Index of chosen badge | `String | Number` | `0` | - |
+| activeKey | Index of chosen badge | `String | Number` | `0` | - |
### Badge API
| Attribute | Description | Type | Default | Accepted Values |
diff --git a/docs/examples-docs/en-US/button.md b/docs/markdown/en-US/button.md
similarity index 84%
rename from docs/examples-docs/en-US/button.md
rename to docs/markdown/en-US/button.md
index c43fc0b50..6b111a173 100644
--- a/docs/examples-docs/en-US/button.md
+++ b/docs/markdown/en-US/button.md
@@ -11,69 +11,57 @@ Vue.component(Button.name, Button);
#### Type
-:::demo Type
```html
Default
Primary
Danger
```
-:::
#### Size
-:::demo Size
```html
Large
Normal
Small
Mini
```
-:::
#### Disabled
-:::demo Disabled
```html
Diabled
```
-:::
#### Loading
-:::demo Loading
```html
```
-:::
#### Custom Tag
Use `tag` prop to custom button tag
-:::demo Custom Tag
```html
Button
```
-:::
#### Action Button
-:::demo Action Button
```html
-Text
+Button
- Text
+ Button
- Text
+ Button
```
-:::
### API
diff --git a/docs/examples-docs/en-US/card.md b/docs/markdown/en-US/card.md
similarity index 84%
rename from docs/examples-docs/en-US/card.md
rename to docs/markdown/en-US/card.md
index d16b460fe..d94c85d71 100644
--- a/docs/examples-docs/en-US/card.md
+++ b/docs/markdown/en-US/card.md
@@ -1,13 +1,3 @@
-
-
## Card
### Install
@@ -21,7 +11,6 @@ Vue.component(Card.name, Card);
#### Basic Usage
-:::demo Basic Usage
```html
```
-:::
#### Advanced Usage
Use `slot` to custom content.
-:::demo Advanced Usage
```html
```
-:::
### API
diff --git a/docs/examples-docs/en-US/cell-swipe.md b/docs/markdown/en-US/cell-swipe.md
similarity index 97%
rename from docs/examples-docs/en-US/cell-swipe.md
rename to docs/markdown/en-US/cell-swipe.md
index 6a4f73bd7..e54abfa9f 100644
--- a/docs/examples-docs/en-US/cell-swipe.md
+++ b/docs/markdown/en-US/cell-swipe.md
@@ -11,7 +11,6 @@ Vue.component(CellSwipe.name, CellSwipe);
#### Basic Usage
-:::demo Basic Usage
```html
Select
@@ -21,7 +20,6 @@ Vue.component(CellSwipe.name, CellSwipe);
Delete
```
-:::
### API
diff --git a/docs/examples-docs/en-US/cell.md b/docs/markdown/en-US/cell.md
similarity index 68%
rename from docs/examples-docs/en-US/cell.md
rename to docs/markdown/en-US/cell.md
index 0878fb4e0..a57c646d1 100644
--- a/docs/examples-docs/en-US/cell.md
+++ b/docs/markdown/en-US/cell.md
@@ -1,13 +1,3 @@
-
-
## Cell
### Install
@@ -22,66 +12,56 @@ Vue.component(CellGroup.name, CellGroup);
#### Basic Usage
-:::demo Basic Usage
```html
-
-
+
+
```
-:::
#### Value only
-:::demo Value only
```html
-
+
```
-:::
#### Left Icon
-:::demo Left Icon
```html
-
+
```
-:::
#### Link
-:::demo Link
```html
-
-
+
+
```
-:::
#### Advanced Usage
-:::demo Advanced Usage
```html
-
+
- Title
+ Cell title
Tag
-
-
+
+
```
-:::
### API
diff --git a/docs/examples-docs/en-US/changelog.md b/docs/markdown/en-US/changelog.md
similarity index 99%
rename from docs/examples-docs/en-US/changelog.md
rename to docs/markdown/en-US/changelog.md
index fee87902c..748d6995f 100644
--- a/docs/examples-docs/en-US/changelog.md
+++ b/docs/markdown/en-US/changelog.md
@@ -4,12 +4,10 @@
`2017-11-15`
**Improvements**
-
-- Icon: add new icons [\#315](https://github.com/youzan/vant/pull/315) ([cookfront](https://github.com/cookfront))
+- Icon: add new icons [\#315](https://github.com/youzan/vant/pull/315) [@cookfront](https://github.com/cookfront)
**Bug Fixes**
-
-- Search: fix box-sizing wrong [\#312](https://github.com/youzan/vant/pull/312) ([chenjiahan](https://github.com/chenjiahan))
+- Search: fix box-sizing wrong [\#312](https://github.com/youzan/vant/pull/312) [@chenjiahan](https://github.com/chenjiahan)
### [0.10.8](https://github.com/youzan/vant/tree/v0.10.8)
`2017-11-11`
diff --git a/docs/examples-docs/en-US/checkbox.md b/docs/markdown/en-US/checkbox.md
similarity index 71%
rename from docs/examples-docs/en-US/checkbox.md
rename to docs/markdown/en-US/checkbox.md
index b8937ed26..ccf2b089c 100644
--- a/docs/examples-docs/en-US/checkbox.md
+++ b/docs/markdown/en-US/checkbox.md
@@ -1,20 +1,3 @@
-
-
## Checkbox
### Install
@@ -29,34 +12,29 @@ Vue.component(CheckboxGroup.name, CheckboxGroup);
#### Basic Usage
-:::demo Basic Usage
```html
-Checkbox 1
+Checkbox 1
```
```javascript
export default {
data() {
return {
- checkbox1: true
+ checked: true
};
}
};
```
-:::
#### Disabled
-:::demo Disabled
```html
-Checkbox 2
+Checkbox 2
```
-:::
-#### CheckboxGroup
+#### Checkbox Group
When Checkboxes are inside a CheckboxGroup, the checked checkboxes's name is an array and bound with CheckboxGroup by v-model.
-:::demo CheckboxGroup
```html
- Checkbox{{ item }}
+ Checkbox {{ item }}
```
-```javascript
-export default {
- data() {
- return {
- list: ['a', 'b', 'c'],
- result: ['a', 'b']
- };
- }
-};
-```
-:::
-
### Checkbox API
| Attribute | Description | Type | Default | Accepted Values |
diff --git a/docs/examples-docs/en-US/contact.md b/docs/markdown/en-US/contact.md
similarity index 74%
rename from docs/examples-docs/en-US/contact.md
rename to docs/markdown/en-US/contact.md
index 5ac30d1df..3ad57d9aa 100644
--- a/docs/examples-docs/en-US/contact.md
+++ b/docs/markdown/en-US/contact.md
@@ -1,71 +1,3 @@
-
-
## Contact
通过 Contact 组件可以实现联系人的展示、选择、编辑等功能。
@@ -82,7 +14,7 @@ Vue.component(ContactEdit.name, ContactEdit);
#### Basic Usage
-:::demo Basic Usage
+
```html
+/>
@@ -106,8 +38,8 @@ Vue.component(ContactEdit.name, ContactEdit);
@@ -186,7 +118,7 @@ export default {
}
};
```
-:::
+
### ContactCard API
| Attribute | Description | Type | Default | Accepted Values |
diff --git a/docs/examples-docs/en-US/coupon.md b/docs/markdown/en-US/coupon.md
similarity index 72%
rename from docs/examples-docs/en-US/coupon.md
rename to docs/markdown/en-US/coupon.md
index 87658c4fd..50a0b8252 100644
--- a/docs/examples-docs/en-US/coupon.md
+++ b/docs/markdown/en-US/coupon.md
@@ -1,63 +1,3 @@
-
-
## Coupon
### Install
@@ -72,24 +12,23 @@ Vue.component(CouponList.name, CouponList);
#### Basic Usage
-:::demo Basic Usage
```html
+/>
+ />
```
@@ -127,7 +66,6 @@ export default {
}
}
```
-:::
### CouponCell API
diff --git a/docs/examples-docs/en-US/datetime-picker.md b/docs/markdown/en-US/datetime-picker.md
similarity index 74%
rename from docs/examples-docs/en-US/datetime-picker.md
rename to docs/markdown/en-US/datetime-picker.md
index 0abf3590a..7f3299f31 100644
--- a/docs/examples-docs/en-US/datetime-picker.md
+++ b/docs/markdown/en-US/datetime-picker.md
@@ -1,21 +1,3 @@
-
-
## DatetimePicker
### Install
@@ -29,15 +11,14 @@ Vue.component(DatetimePicker.name, DatetimePicker);
#### Basic Usage
-:::demo Basic Usage
```html
```
@@ -54,25 +35,21 @@ export default {
}
};
```
-:::
#### Date Picker
-:::demo Date Picker
```html
```
-:::
#### Time Picker
-:::demo Time Picker
```html
```
-:::
-
### API
diff --git a/docs/markdown/en-US/dialog.md b/docs/markdown/en-US/dialog.md
new file mode 100644
index 000000000..82063a860
--- /dev/null
+++ b/docs/markdown/en-US/dialog.md
@@ -0,0 +1,63 @@
+## Dialog
+
+### Install
+
+```js
+import { Dialog } from 'vant';
+```
+
+### Usage
+
+#### Alert dialog
+Used to prompt for some messages, only including one confirm button
+
+```javascript
+Dialog.alert({
+ title: 'Title',
+ message: 'Content'
+}).then(() => {
+ // on close
+});
+
+Dialog.alert({
+ message: 'Content'
+}).then(() => {
+ // on close
+});
+```
+
+#### Confirm dialog
+Used to confirm some messages, including a confirm button and a cancel button
+
+```javascript
+ Dialog.confirm({
+ title: 'Title',
+ message: 'Content'
+}).then(() => {
+ // on confirm
+}).catch(() => {
+ // on cancel
+});
+```
+
+### Methods
+
+| Name | Attribute | Return value | Description |
+|-----------|-----------|-----------|-------------|
+| Dialog.alert | options | `Promise` | Show alert dialog |
+| Dialog.confirm | options | `Promise` | Show confim dialog |
+| Dialog.close | - | `void` | Close dialog |
+
+### Options
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| title | Title | `String` | - | - |
+| message | Message | `String` | - | - |
+| showConfirmButton | Whether to show confirm button | `Boolean` | `true` | - |
+| showCancelButton | Whether to show cancel button | `Boolean` | `false` | - |
+| confirmButtonText | Confirm button text | `String` | `Confirm` | - |
+| cancelButtonText | Cancel button test | `String` | `Cancel` | - |
+| overlay | Whether to show overlay | `Boolean` | `true` | - |
+| closeOnClickOverlay | Whether to close when click overlay | `Boolean` | `false` | - |
+| lockOnScroll | Whether to lock body scroll | `Boolean` | `true` | - |
diff --git a/docs/examples-docs/en-US/field.md b/docs/markdown/en-US/field.md
similarity index 87%
rename from docs/examples-docs/en-US/field.md
rename to docs/markdown/en-US/field.md
index 12be8de48..4ae0c3530 100644
--- a/docs/examples-docs/en-US/field.md
+++ b/docs/markdown/en-US/field.md
@@ -1,16 +1,3 @@
-
-
## Field
### Install
@@ -25,18 +12,15 @@ Vue.component(Field.name, Field);
#### Basic Usage
The value of filed is bound with v-model.
-:::demo Basic Usage
```html
```
-:::
-#### Custom Type
+#### Custom type
Use `type` prop to custom diffrent type fileds.
-:::demo Custom Type
```html
```
-:::
#### Disabled
-:::demo Disabled
```html
```
-:::
-#### Error Info
+#### Error info
-:::demo Error Info
```html
```
-:::
#### Auto resize
Textarea Filed can be auto resize when has `autosize` prop
-:::demo Auto resize
```html
```
-:::
### API
diff --git a/docs/examples-docs/en-US/goods-action.md b/docs/markdown/en-US/goods-action.md
similarity index 87%
rename from docs/examples-docs/en-US/goods-action.md
rename to docs/markdown/en-US/goods-action.md
index bd62aa344..b5cd451f8 100644
--- a/docs/examples-docs/en-US/goods-action.md
+++ b/docs/markdown/en-US/goods-action.md
@@ -1,18 +1,3 @@
-
-
## GoodsAction
### Install
@@ -30,7 +15,7 @@ Vue.component(GoodsActionMiniBtn.name, GoodsActionMiniBtn);
### Usage
-:::demo
+
```html
@@ -60,7 +45,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/markdown/en-US/icon.md b/docs/markdown/en-US/icon.md
new file mode 100644
index 000000000..ab24205fe
--- /dev/null
+++ b/docs/markdown/en-US/icon.md
@@ -0,0 +1,23 @@
+## Icon
+
+### Install
+``` javascript
+import { Icon } from 'vant';
+
+Vue.component(Icon.name, Icon);
+```
+
+### Usage
+
+#### Basic Usage
+View all usable icons on the right.
+
+```html
+
+```
+
+### API
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| name | Icon name | `String` | `''` | - |
diff --git a/docs/markdown/en-US/image-preview.md b/docs/markdown/en-US/image-preview.md
new file mode 100644
index 000000000..5fa8bd555
--- /dev/null
+++ b/docs/markdown/en-US/image-preview.md
@@ -0,0 +1,32 @@
+## ImagePreview
+
+### Install
+
+```js
+import { ImagePreview } from 'vant';
+```
+
+### Usage
+
+#### Basic Usage
+
+```javascript
+ImagePreview([
+ 'https://img.yzcdn.cn/1.jpg',
+ 'https://img.yzcdn.cn/2.jpg'
+]);
+```
+
+#### Custom Start Position
+```javascript
+ImagePreview([
+ 'https://img.yzcdn.cn/1.jpg',
+ 'https://img.yzcdn.cn/2.jpg'
+], 1);
+```
+
+### Arguments
+
+| Attribute | Description | Type |
+|-----------|-----------|-----------|
+| imageUrls | Image URL list | `Array` |
diff --git a/docs/examples-docs/en-US/layout.md b/docs/markdown/en-US/layout.md
similarity index 97%
rename from docs/examples-docs/en-US/layout.md
rename to docs/markdown/en-US/layout.md
index 5095cb847..0a65a42f4 100644
--- a/docs/examples-docs/en-US/layout.md
+++ b/docs/markdown/en-US/layout.md
@@ -16,7 +16,7 @@ Vue.component(Col.name, Col);
Layout are based on 24-column. The attribute `span` in `Col` means the number of column the grid spans. Of course, You can use `offset` attribute to set number of spacing on the left side of the grid.
-:::demo Basic Usage
+
```html
span: 8
@@ -34,13 +34,13 @@ Layout are based on 24-column. The attribute `span` in `Col` means the number of
offset: 12, span: 12
```
-:::
+
#### Column Spacing
Set grid spacing using `gutter` attribute. The default value is 0
-:::demo Column Spacing
+
```html
span: 8
@@ -48,7 +48,7 @@ Set grid spacing using `gutter` attribute. The default value is 0
span: 8
```
-:::
+
### API
diff --git a/docs/examples-docs/en-US/lazyload.md b/docs/markdown/en-US/lazyload.md
similarity index 79%
rename from docs/examples-docs/en-US/lazyload.md
rename to docs/markdown/en-US/lazyload.md
index 0d876e0f1..3a22a27e9 100644
--- a/docs/examples-docs/en-US/lazyload.md
+++ b/docs/markdown/en-US/lazyload.md
@@ -42,7 +42,6 @@ Vue.use(Lazyload, options);
#### Basic Usage
-:::demo Basic Usage
```html
```
@@ -59,53 +58,22 @@ export default {
}
}
```
-:::
-#### Background Image
+#### Lazyload Background Image
Use `v-lazy:background-image` to set background url, and declare the height of the container.
-:::demo Background Image
```html
-
+
```
-```javascript
-export default {
- data() {
- return {
- backgroundImageList: [
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]
- };
- }
-}
-```
-:::
-
#### Lazyload Component
-:::demo Lazyload Component
```html
-
+
```
-```javascript
-export default {
- data() {
- return {
- componentImageList: [
- 'https://img.yzcdn.cn/1.jpg',
- 'https://img.yzcdn.cn/2.jpg'
- ]
- };
- }
-}
-```
-:::
-
### Options
| Attribute | Description | Type | Default | Accepted Values |
diff --git a/docs/examples-docs/en-US/loading.md b/docs/markdown/en-US/loading.md
similarity index 52%
rename from docs/examples-docs/en-US/loading.md
rename to docs/markdown/en-US/loading.md
index 0f4348d9c..d9c03cac8 100644
--- a/docs/examples-docs/en-US/loading.md
+++ b/docs/markdown/en-US/loading.md
@@ -11,30 +11,24 @@ Vue.component(Loading.name, Loading);
#### Solid Circle
-:::demo Solid Circle
```html
-
-
+
+
```
-:::
#### Gradient Circle
-:::demo Gradient Circle
```html
-
-
+
+
```
-:::
#### Spinner
-:::demo Spinner
```html
-
-
+
+
```
-:::
### API
diff --git a/docs/examples-docs/en-US/nav-bar.md b/docs/markdown/en-US/nav-bar.md
similarity index 67%
rename from docs/examples-docs/en-US/nav-bar.md
rename to docs/markdown/en-US/nav-bar.md
index 753fddb55..27425dd40 100644
--- a/docs/examples-docs/en-US/nav-bar.md
+++ b/docs/markdown/en-US/nav-bar.md
@@ -11,35 +11,31 @@ Vue.component(NavBar.name, NavBar);
#### Basic Usage
-:::demo Basic Usage
```html
```
-:::
#### Advanced Usage
-:::demo Advanced Usage
```html
-
+
```
-:::
### API
| Attribute | Description | Type | Default | Accepted Values |
|-----------|-----------|-----------|-------------|-------------|
| title | Title | `String` | `''` | - |
-| left-text | Left Text | `String` | `''` | - |
-| right-text | Right Text | `String` | `''` | - |
-| left-arrow | Whether to show left arrow | `Boolean` | `false` | - |
+| leftText | Left Text | `String` | `''` | - |
+| rightText | Right Text | `String` | `''` | - |
+| leftArrow | Whether to show left arrow | `Boolean` | `false` | - |
| fixed | Whether to fixed top | `Boolean` | `false` | - |
### Slot
diff --git a/docs/examples-docs/en-US/notice-bar.md b/docs/markdown/en-US/notice-bar.md
similarity index 90%
rename from docs/examples-docs/en-US/notice-bar.md
rename to docs/markdown/en-US/notice-bar.md
index a8511ede1..d088579fb 100644
--- a/docs/examples-docs/en-US/notice-bar.md
+++ b/docs/markdown/en-US/notice-bar.md
@@ -11,28 +11,23 @@ Vue.component(NoticeBar.name, NoticeBar);
#### Basic Usage
-:::demo Basic Usage
```html
```
-:::
#### Disable scroll
-:::demo Disable scroll
```html
Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily.
```
-:::
#### Mode
-:::demo Mode
```html
Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily.
@@ -42,7 +37,6 @@ Vue.component(NoticeBar.name, NoticeBar);
Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily.
```
-:::
### API
diff --git a/docs/examples-docs/en-US/number-keyboard.md b/docs/markdown/en-US/number-keyboard.md
similarity index 82%
rename from docs/examples-docs/en-US/number-keyboard.md
rename to docs/markdown/en-US/number-keyboard.md
index b718f2807..f4c065fc0 100644
--- a/docs/examples-docs/en-US/number-keyboard.md
+++ b/docs/markdown/en-US/number-keyboard.md
@@ -1,24 +1,3 @@
-
-
## NumberKeyboard
### Install
@@ -32,14 +11,13 @@ Vue.component(NumberKeyboard.name, NumberKeyboard);
#### Basic Usage
-:::demo Basic Usage
```html
- ShowKeyboard
+ Show Keyboard
- HideKeyboard
+ Hide Keyboard
- Panel Content
+ Content
```
-:::
#### Advanced Usage
-:::demo Advanced Usage
```html
- Panel Content
+ Content
Button
Button
```
-:::
### API
diff --git a/docs/examples-docs/en-US/password-input.md b/docs/markdown/en-US/password-input.md
similarity index 95%
rename from docs/examples-docs/en-US/password-input.md
rename to docs/markdown/en-US/password-input.md
index 3671faf64..ff46c37f8 100644
--- a/docs/examples-docs/en-US/password-input.md
+++ b/docs/markdown/en-US/password-input.md
@@ -33,14 +33,13 @@ Vue.component(NumberKeyBoard.name, NumberKeyBoard);
#### Basic Usage
-:::demo Basic Usage
```html
+/>
+/>
```
```javascript
@@ -57,7 +56,7 @@ export default {
return {
value: '',
showKeyboard: true
- }
+ };
},
methods: {
@@ -70,7 +69,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/examples-docs/en-US/picker.md b/docs/markdown/en-US/picker.md
similarity index 68%
rename from docs/examples-docs/en-US/picker.md
rename to docs/markdown/en-US/picker.md
index b9cfdca2f..cd823e513 100644
--- a/docs/examples-docs/en-US/picker.md
+++ b/docs/markdown/en-US/picker.md
@@ -1,42 +1,3 @@
-
-
## Picker
### Install
@@ -50,9 +11,9 @@ Vue.component(Picker.name, Picker);
#### Basic Usage
-:::demo Basic Usage
+
```html
-
+
```
```javascript
@@ -78,26 +39,25 @@ export default {
},
methods: {
- handlePickerChange(picker, values) {
+ onChange(picker, values) {
picker.setColumnValues(1, citys[values[0]]);
}
}
};
```
-:::
+
#### Picker with toolbar
-:::demo Picker with toolbar
```html
+ @change="onChange"
+ @cancel="onCancel"
+ @confirm="onConfirm"
+/>
```
```javascript
@@ -124,19 +84,18 @@ export default {
},
methods: {
- handlePickerChange(picker, values) {
+ onChange(picker, values) {
picker.setColumnValues(1, citys[values[0]]);
},
- handlePickerCancel() {
+ onCancel() {
Toast('Cancel');
},
- handlePickerConfirm() {
+ onConfirm() {
Toast('Confirm');
}
}
};
```
-:::
### API
diff --git a/docs/markdown/en-US/popup.md b/docs/markdown/en-US/popup.md
new file mode 100644
index 000000000..5e14339c6
--- /dev/null
+++ b/docs/markdown/en-US/popup.md
@@ -0,0 +1,48 @@
+## Popup
+
+### Install
+``` javascript
+import { Popup } from 'vant';
+
+Vue.component(Popup.name, Popup);
+```
+
+### Usage
+
+#### Basic Usage
+Popup is located in the middle of the screen by default
+
+```html
+Content
+```
+
+```javascript
+export default {
+ data() {
+ return {
+ show: false
+ }
+ }
+};
+```
+
+#### Position
+Use `position` prop to set popup display position
+
+```html
+
+ Content
+
+```
+
+### API
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| v-model | Whether to show popup | `Boolean` | `false` | - |
+| overlay | Whether to show overlay | `Boolean` | `true` | - |
+| lockOnScroll | Lock body scroll | `Boolean` | `false` | - |
+| position | Position | `String` | - | `top` `bottom` `right` `left` |
+| closeOnClickOverlay | Close popup when click overlay | `Boolean` | `true` | - |
+| transition | Transition | `String` | `popup-slide` | - |
+| preventScroll | Prevent background scroll | `Boolean` | `false` | - |
diff --git a/docs/examples-docs/en-US/progress.md b/docs/markdown/en-US/progress.md
similarity index 51%
rename from docs/examples-docs/en-US/progress.md
rename to docs/markdown/en-US/progress.md
index f0a6a4fe2..830dc792e 100644
--- a/docs/examples-docs/en-US/progress.md
+++ b/docs/markdown/en-US/progress.md
@@ -12,36 +12,30 @@ Vue.component(Progress.name, Progress);
#### Basic Usage
Use 'percentage' prop to set current progress
-:::demo Basic Usage
```html
-
-
-
+
+
+
```
-:::
#### Inactive
-:::demo Inactive
```html
-
-
-
+
+
+
```
-:::
#### Custom Style
-Use `pivot-text` to custom text,use `color` to custom bar color
+Use `pivotText` to custom text,use `color` to custom bar color
-:::demo Custom Style
```html
-
-
-
+
+
+
```
-:::
### API
diff --git a/docs/examples-docs/en-US/pull-refresh.md b/docs/markdown/en-US/pull-refresh.md
similarity index 73%
rename from docs/examples-docs/en-US/pull-refresh.md
rename to docs/markdown/en-US/pull-refresh.md
index e68df4985..45d1ab0d3 100644
--- a/docs/examples-docs/en-US/pull-refresh.md
+++ b/docs/markdown/en-US/pull-refresh.md
@@ -1,33 +1,3 @@
-
-
## PullRefresh
### Install
@@ -39,7 +9,6 @@ Vue.component(PullRefresh.name, PullRefresh);
### Usage
-:::demo
```html
-export default {
- data() {
- return {
- radio1: '1',
- radio2: '2',
- radio3: '1',
- radio4: '1'
- };
- }
-};
-
-
## Radio
### Install
@@ -25,74 +12,43 @@ Vue.component(Radio.name, Radio);
#### Basic Usage
Use `v-model` to bind check status of radio. The value will be set to the name of radio when radio get checked.
-:::demo Basic Usage
```html
-
- Radio 1
- Radio 2
-
+Radio 1
+Radio 2
```
+
```javascript
export default {
data() {
return {
- radio1: '1'
+ radio: '1'
}
}
};
```
-:::
#### Disabled
-:::demo Disabled
```html
-
- Disabled
- Disabled and checked
-
+Disabled
+Disabled and checked
```
-```javascript
-export default {
- data() {
- return {
- radio2: '2'
- }
- }
-};
-```
-:::
-#### RadioGroup
+#### Radio Group
When Radios are inside a RadioGroup, the checked radio's name is bound with CheckboxGroup by `v-model`.
-:::demo RadioGroup
```html
-
-
- Radio 1
- Radio 2
-
-
+
+ Radio 1
+ Radio 2
+
```
-
-```javascript
-export default {
- data() {
- return {
- radio3: '1'
- }
- }
-};
-```
-:::
-#### With Cell
+#### Inside a Cell
-:::demo With Cell
```html
-
+
Radio 1
Radio 2
@@ -100,17 +56,6 @@ export default {
```
-```javascript
-export default {
- data() {
- return {
- radio4: '1'
- }
- }
-};
-```
-:::
-
### Radio API
| Attribute | Description | Type | Default | Accepted Values |
diff --git a/docs/examples-docs/en-US/search.md b/docs/markdown/en-US/search.md
similarity index 81%
rename from docs/examples-docs/en-US/search.md
rename to docs/markdown/en-US/search.md
index 2509ee80a..8462c7512 100644
--- a/docs/examples-docs/en-US/search.md
+++ b/docs/markdown/en-US/search.md
@@ -1,24 +1,3 @@
-
-
## Search
### Install
@@ -32,7 +11,6 @@ Vue.component(Search.name, Search);
#### Basic Usage
-:::demo Basic Usage
```html
```
@@ -44,7 +22,6 @@ export default {
}
}
```
-:::
#### Listen to Events
`search` event will be triggered when click the search button on the keyboard.
@@ -53,33 +30,29 @@ export default {
Tips: There will be a search button on the keyboard when Search is inside a form in iOS.
-:::demo Listen to Events
```html
```
-:::
#### Custom Button
Use `action` slot to custom right button, `cancel` event will no longer be triggered when use this slot
-:::demo Custom Button
```html
Search
```
-:::
### API
diff --git a/docs/examples-docs/en-US/sku.md b/docs/markdown/en-US/sku.md
similarity index 66%
rename from docs/examples-docs/en-US/sku.md
rename to docs/markdown/en-US/sku.md
index db38c031f..77ac19c1e 100644
--- a/docs/examples-docs/en-US/sku.md
+++ b/docs/markdown/en-US/sku.md
@@ -1,44 +1,5 @@
## Sku
-
-
### Install
```javascript
import { Sku } from 'vant';
@@ -48,70 +9,57 @@ Vue.component(Sku.name, Sku);
### Usage
#### Basic Usage
-:::demo
-```html
-
-
-
-
-
基础用法
-
-
-```
-:::
-#### 自定义sku slot区块
-:::demo
```html
-
-
-
-
-
-
-
-
-
- 积分兑换
-
-
-
- 买买买
-
-
-
-
-
自定义sku actions
-
-
+
+```
+
+#### 自定义 sku slot 区块
+
+```html
+
+
+
+
+
+
+
+ 积分兑换
+
+
+
+ 买买买
+
+
+
+
```
-:::
### API
diff --git a/docs/examples-docs/en-US/stepper.md b/docs/markdown/en-US/stepper.md
similarity index 78%
rename from docs/examples-docs/en-US/stepper.md
rename to docs/markdown/en-US/stepper.md
index b8dea95f9..fa6614d64 100644
--- a/docs/examples-docs/en-US/stepper.md
+++ b/docs/markdown/en-US/stepper.md
@@ -1,14 +1,3 @@
-
-
## Stepper
### Install
@@ -22,9 +11,8 @@ Vue.component(Stepper.name, Stepper);
#### Basic Usage
-:::demo Basic Usage
```html
-
+
```
```javascript
@@ -36,29 +24,24 @@ export default {
}
}
```
-:::
#### Disabled
-:::demo Disabled
```html
-
+
```
-:::
#### Advanced Usage
-:::demo Advanced Usage
```html
```
-:::
### API
diff --git a/docs/examples-docs/en-US/steps.md b/docs/markdown/en-US/steps.md
similarity index 66%
rename from docs/examples-docs/en-US/steps.md
rename to docs/markdown/en-US/steps.md
index d2750537c..d5920ecf5 100644
--- a/docs/examples-docs/en-US/steps.md
+++ b/docs/markdown/en-US/steps.md
@@ -1,19 +1,3 @@
-
-
## Steps
### Install
@@ -28,7 +12,6 @@ Vue.component(Steps.name, Steps);
#### Basic Usage
-:::demo Basic Usage
```html
Step1
@@ -36,8 +19,6 @@ Vue.component(Steps.name, Steps);
Step3
Step4
-
-
Next
```
```javascript
@@ -46,25 +27,16 @@ export default {
return {
active: 0
};
- },
-
- methods: {
- nextStep() {
- this.active = ++this.active % 4;
- }
}
}
```
-:::
#### Description
-:::demo Description
```html
@@ -74,13 +46,11 @@ export default {
Step4
```
-:::
#### Vertical Steps
-:::demo Vertical Steps
```html
-
+
【City】Status1
2016-07-12 12:40
@@ -95,22 +65,6 @@ export default {
```
-:::
-
-#### Advanced Usage
-
-:::demo Advanced Usage
-```html
-
-
- Some text
- Step1
- Step2
- Step3
- Step4
-
-```
-:::
### Steps API
diff --git a/docs/examples-docs/en-US/submit-bar.md b/docs/markdown/en-US/submit-bar.md
similarity index 78%
rename from docs/examples-docs/en-US/submit-bar.md
rename to docs/markdown/en-US/submit-bar.md
index e30a97447..0cb502112 100644
--- a/docs/examples-docs/en-US/submit-bar.md
+++ b/docs/markdown/en-US/submit-bar.md
@@ -37,67 +37,61 @@ Vue.component(SubmitBar.name, SubmitBar);
#### Basic Usage
-:::demo Basic Usage
```html
```
-:::
#### Disabled
禁用状态下不会触发`submit`事件
-:::demo 禁用状态
```html
```
-:::
#### Loading
加载状态下不会触发`submit`事件
-:::demo 加载状态
+
```html
```
-:::
-####
+#### Advanced Usage
提示文案中的额外操作和说明
-:::demo 提示文案中添加操作
+
```html
- 您的收货地址不支持同城送, 修改地址 >
+ 您的收货地址不支持同城送, 修改地址 >
```
-:::
### API
| Attribute | Description | Type | Default | 必须 |
|-----------|-----------|-----------|-------------|-------------|
| price | 价格(单位分) | `Number` | - | 是 |
-| button-text | 按钮文字 | `String` | - | 是 |
-| button-type | 按钮类型 | `String` | `danger` | 否 |
+| buttonText | 按钮文字 | `String` | - | 是 |
+| buttonType | 按钮类型 | `String` | `danger` | 否 |
| tip | 提示文案 | `String` | - | 否 |
| disabled | 是否禁用按钮 | `Boolean` | `false` | 否 |
| loading | 是否显示加载中的按钮 | `Boolean` | `false` | 否 |
diff --git a/docs/examples-docs/en-US/swipe.md b/docs/markdown/en-US/swipe.md
similarity index 73%
rename from docs/examples-docs/en-US/swipe.md
rename to docs/markdown/en-US/swipe.md
index 5c2287909..8d89337e5 100644
--- a/docs/examples-docs/en-US/swipe.md
+++ b/docs/markdown/en-US/swipe.md
@@ -1,18 +1,3 @@
-
-
## Swipe
### Install
@@ -28,7 +13,6 @@ Vue.component(SwipeItem.name, SwipeItem);
#### Basic Usage
Use `autoplay` prop to set autoplay interval
-:::demo Basic Usage
```html
1
@@ -37,12 +21,10 @@ Use `autoplay` prop to set autoplay interval
4
```
-:::
#### Image Lazyload
Use [Lazyload](#/zh-CN/component/lazyload) component to lazyload image
-:::demo Image Lazyload
```html
@@ -63,7 +45,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/examples-docs/en-US/switch-cell.md b/docs/markdown/en-US/switch-cell.md
similarity index 75%
rename from docs/examples-docs/en-US/switch-cell.md
rename to docs/markdown/en-US/switch-cell.md
index cc7f20362..87d1ffb06 100644
--- a/docs/examples-docs/en-US/switch-cell.md
+++ b/docs/markdown/en-US/switch-cell.md
@@ -1,17 +1,6 @@
## SwitchCell
-
`SwitchCell` component is an encapsulation of `Switch` and `Cell`.
-
-
### Install
``` javascript
import { SwitchCell } from 'vant';
@@ -23,10 +12,9 @@ Vue.component(SwitchCell.name, SwitchCell);
#### Basic Usage
-:::demo Basic Usage
```html
-
+
```
@@ -39,29 +27,26 @@ export default {
}
}
```
-:::
+
#### Disabled
use `disabled` property to disable the component
-:::demo Disabled component
```html
-
+
```
-:::
+
#### Loading
use `loading` property to keep component in loading state
-:::demo Component in loading
```html
-
+
```
-:::
### API
diff --git a/docs/examples-docs/en-US/switch.md b/docs/markdown/en-US/switch.md
similarity index 65%
rename from docs/examples-docs/en-US/switch.md
rename to docs/markdown/en-US/switch.md
index 6868d48fd..6a71930cf 100644
--- a/docs/examples-docs/en-US/switch.md
+++ b/docs/markdown/en-US/switch.md
@@ -1,29 +1,3 @@
-
-
## Switch
### Install
@@ -37,7 +11,6 @@ Vue.component(Switch.name, Switch);
#### Basic Usage
-:::demo Basic Usage
```html
```
@@ -51,35 +24,31 @@ export default {
}
};
```
-:::
#### Disabled
-:::demo Disabled
```html
```
-:::
#### Loading
-:::demo Loading
```html
```
-:::
#### Advanced usage
-:::demo Advanced usage
+
```html
-
+
```
+
```js
export default {
data() {
return {
- checked2: true
+ checked: true
};
},
@@ -89,13 +58,12 @@ export default {
title: 'Confirm',
message: 'Are you sure to toggle switch?'
}).then(() => {
- this.checked2 = checked;
+ this.checked = checked;
});
}
}
};
```
-:::
### API
diff --git a/docs/markdown/en-US/tab.md b/docs/markdown/en-US/tab.md
new file mode 100644
index 000000000..f500a941a
--- /dev/null
+++ b/docs/markdown/en-US/tab.md
@@ -0,0 +1,125 @@
+## Tabs
+
+### Install
+``` javascript
+import { Tab, Tabs } from 'vant';
+
+Vue.component(Tab.name, Tab);
+Vue.component(Tabs.name, Tabs);
+```
+
+### Usage
+
+#### Basic Usage
+
+By default, the first tab is actived. You can set `active` attribute on `van-tabs` to active specified tab.
+
+```html
+
+
+ content of tab {{ index }}
+
+
+```
+
+```js
+export default {
+ data() {
+ return {
+ active: 2
+ };
+ }
+}
+```
+
+#### Swipe Tabs
+
+By default more than 4 tabs, you can scroll through the tabs. You can set `swipeThreshold` attribute to customize threshold number.
+
+```html
+
+
+ content of tab {{ index }}
+
+
+```
+
+#### Disabled Tab
+
+You can set `disabled` attribute on the corresponding `van-tab`.
+
+```html
+
+
+ content of tab {{ index }}
+
+
+```
+
+```javascript
+export default {
+ methods: {
+ onClickDisabled() {
+ Toast('Disabled!');
+ }
+ }
+};
+```
+
+#### Card Style
+
+Tabs styled as cards.
+
+```html
+
+
+ content of tab {{ index }}
+
+
+```
+
+#### Click Event
+
+You can bind `click` event on `van-tabs`, the event handler function has one parameters: index of click tab.
+
+```html
+
+
+ content of tab {{ index }}
+
+
+```
+
+```javascript
+export default {
+ methods: {
+ handleTabClick(index) {
+ Toast(index);
+ }
+ }
+};
+```
+
+### Tabs API
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| type | There are two style tabs, set this attribute to change tab style | `String` | `line` | `card` |
+| active | Index of active tab | `String` `Number` | `0` | - |
+| duration | Toggle tab's animation time | `Number` | `0.3` | - | - |
+| swipeThreshold | Set swipe tabs threshold | `Number` | `4` | - | - |
+
+### Tab API
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| title | Tab title | `String` | - | - |
+| disabled | Whether disabled current tab | `Boolean` | `false` | - |
+
+### Tabs Event
+
+| Event | Description | Attribute |
+|-----------|-----------|-----------|
+| click | Triggered when click tab | index:index of current tab |
+| disabled | Triggered when click disabled tab | index:index of current tab |
+
diff --git a/docs/examples-docs/en-US/tabbar.md b/docs/markdown/en-US/tabbar.md
similarity index 79%
rename from docs/examples-docs/en-US/tabbar.md
rename to docs/markdown/en-US/tabbar.md
index 4894d7270..16cea6418 100644
--- a/docs/examples-docs/en-US/tabbar.md
+++ b/docs/markdown/en-US/tabbar.md
@@ -1,20 +1,5 @@
## Tabbar
-
-
### Install
``` javascript
import { Tabbar, TabbarItem } from 'vant';
@@ -27,7 +12,6 @@ Vue.component(TabbarItem.name, TabbarItem);
#### Basic Usage
-:::demo Basic Usage
```html
Tab
@@ -46,17 +30,15 @@ export default {
}
}
```
-:::
#### Custom icon
Use `icon` slot to custom icon
-:::demo Custom icon
```html
-
+
Custom
-
+
Tab
Tab
@@ -67,7 +49,7 @@ Use `icon` slot to custom icon
export default {
data() {
return {
- active2: 0,
+ active: 0,
icon: {
normal: '//img.yzcdn.cn/1.png',
active: '//img.yzcdn.cn/2.png'
@@ -76,7 +58,6 @@ export default {
}
}
```
-:::
### Tabbar API
diff --git a/docs/examples-docs/en-US/tag.md b/docs/markdown/en-US/tag.md
similarity index 93%
rename from docs/examples-docs/en-US/tag.md
rename to docs/markdown/en-US/tag.md
index 49ac4b432..60d836db0 100644
--- a/docs/examples-docs/en-US/tag.md
+++ b/docs/markdown/en-US/tag.md
@@ -11,36 +11,30 @@ Vue.component(Tag.name, Tag);
#### Basic Usage
-:::demo Basic Usage
```html
Tag
Tag
Tag
Tag
```
-:::
#### Plain style
-:::demo Plain style
```html
Tag
Tag
Tag
Tag
```
-:::
#### Mark style
-:::demo Mark style
```html
Tag
Tag
Tag
Tag
```
-:::
### API
diff --git a/docs/markdown/en-US/theme.md b/docs/markdown/en-US/theme.md
new file mode 100644
index 000000000..5ec97e586
--- /dev/null
+++ b/docs/markdown/en-US/theme.md
@@ -0,0 +1,55 @@
+## Custom Theme (In translation)
+
+`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/markdown/en-US/toast.md b/docs/markdown/en-US/toast.md
new file mode 100644
index 000000000..73739ced2
--- /dev/null
+++ b/docs/markdown/en-US/toast.md
@@ -0,0 +1,73 @@
+## Toast
+
+### Install
+
+```javascript
+import { Toast } from 'vant';
+```
+
+### Usage
+
+#### Text
+
+```javascript
+Toast('Some messages');
+```
+
+
+#### Loading
+
+```javascript
+Toast.loading({ mask: true });
+```
+
+
+#### Success/Fail
+
+```javascript
+Toast.success('Success');
+Toast.fail('Fail');
+```
+
+
+#### Advanced Usage
+
+```javascript
+const toast = Toast.loading({
+ duration: 0, // continuous display toast
+ forbidClick: true, // forbid click background
+ message: '3 seconds'
+});
+
+let second = 3;
+const timer = setInterval(() => {
+ second--;
+ if (second) {
+ toast.message = `${second} seconds`;
+ } else {
+ clearInterval(timer);
+ Toast.clear();
+ }
+}, 1000);
+```
+
+### Methods
+
+| Methods | Attribute | Return value | Description |
+|-----------|-----------|-----------|-------------|
+| Toast | `options | message` | toast instance | Show toast |
+| Toast.loading | `options | message` | toast instance | Show loading toast |
+| Toast.success | `options | message` | toast instance | Show success toast |
+| Toast.fail | `options | message` | toast instance | Show fail toast |
+| Toast.clear | - | `void` | Close |
+
+### Options
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| type | Type | `String` | `text` | `loading` `success` `fail` `html` |
+| message | Message | `String` | `''` | - |
+| position | Position | `String` | `middle` | `top` `bottom` |
+| mask | Whether to show mask | `Boolean` | `false` | - |
+| forbidClick | Whether to forbid click background | `Boolean` | `false` | - |
+| duration | Toast duration(ms) | `Number` | `3000` | Toast won't disappear if value is 0 |
diff --git a/docs/examples-docs/en-US/tree-select.md b/docs/markdown/en-US/tree-select.md
similarity index 53%
rename from docs/examples-docs/en-US/tree-select.md
rename to docs/markdown/en-US/tree-select.md
index 7bf53824c..602ca1146 100644
--- a/docs/examples-docs/en-US/tree-select.md
+++ b/docs/markdown/en-US/tree-select.md
@@ -1,79 +1,3 @@
-
-
## TreeSelect
### Install
@@ -87,7 +11,6 @@ Vue.component(TreeSelect.name, TreeSelect);
#### Basic Usage
-:::demo Basic Usage
```html
+/>
```
```javascript
@@ -114,13 +37,11 @@ export default {
this.mainActiveIndex = index;
},
onItemClick(data) {
- console.log(data);
this.activeId = data.id;
}
}
}
```
-:::
### API
@@ -128,9 +49,9 @@ export default {
| Attribute | Description | Type | Default | 必须 |
|-----------|-----------|-----------|-------------|-------------|
-| items | Required datasets for the component, see Data Structure for detail. | Array | [] | - |
-| mainActiveIndex | The index of selected parent node | Number | 0 | - |
-| activeId | Id of selected item | Number | 0 | - |
+| items | Required datasets for the component, see Data Structure for detail. | `Array` | `[]` | - |
+| mainActiveIndex | The index of selected parent node | `Number` | `0` | - |
+| activeId | Id of selected item | `Number` | `0` | - |
#### Event
| Event | Description | Attribute |
diff --git a/docs/markdown/en-US/uploader.md b/docs/markdown/en-US/uploader.md
new file mode 100644
index 000000000..b3becdc98
--- /dev/null
+++ b/docs/markdown/en-US/uploader.md
@@ -0,0 +1,45 @@
+## Uploader
+
+### Install
+``` javascript
+import { Uploader } from 'vant';
+
+Vue.component(Uploader.name, Uploader);
+```
+
+### Usage
+
+#### Basic Usage
+
+```html
+
+
+
+
+
+```
+
+```javascript
+export default {
+ methods: {
+ logContent(file) {
+ console.log(file)
+ }
+ }
+};
+```
+
+### API
+
+| Attribute | Description | Type | Default | Accepted Values |
+|-----------|-----------|-----------|-------------|-------------|
+| resultType | The way to read the file, read as base64; read as text | `String` | `dataUrl` | `text` |
+| disable | Whether to disable the upload, set to true during the image upload to prevent users from clicking this component to upload pictures | `Boolean` | `false` | - |
+| beforeRead | Hook before reading the file, the first parameter is the selected file, return false to stop reading the file | `Function` | - | - |
+| afterRead | Hook after reading the file, parameter format: { file ,content } | `Function` | - | - |
+
+### Slot
+
+| name | Description |
+|-----------|-----------|
+| - | Custom icon |
diff --git a/docs/examples-docs/en-US/waterfall.md b/docs/markdown/en-US/waterfall.md
similarity index 72%
rename from docs/examples-docs/en-US/waterfall.md
rename to docs/markdown/en-US/waterfall.md
index 5937a5517..dea65a31e 100644
--- a/docs/examples-docs/en-US/waterfall.md
+++ b/docs/markdown/en-US/waterfall.md
@@ -27,40 +27,9 @@ export default {
### Usage
-
-
#### Basic Usage
-:::demo Basic Usage
```html
-This list will load items will scroll to bottom.
{
+ progress.done();
+ }).catch(() => {
+ progress.done();
+ });
+ };
+}
+
+export default {
+ 'zh-CN/actionsheet': wrapper(r => require.ensure([], () => r(require('./zh-CN/actionsheet.md')), 'zh-CN/actionsheet')),
+ 'zh-CN/address-edit': wrapper(r => require.ensure([], () => r(require('./zh-CN/address-edit.md')), 'zh-CN/address-edit')),
+ 'zh-CN/address-list': wrapper(r => require.ensure([], () => r(require('./zh-CN/address-list.md')), 'zh-CN/address-list')),
+ 'zh-CN/area': wrapper(r => require.ensure([], () => r(require('./zh-CN/area.md')), 'zh-CN/area')),
+ 'zh-CN/badge': wrapper(r => require.ensure([], () => r(require('./zh-CN/badge.md')), 'zh-CN/badge')),
+ 'zh-CN/button': wrapper(r => require.ensure([], () => r(require('./zh-CN/button.md')), 'zh-CN/button')),
+ 'zh-CN/card': wrapper(r => require.ensure([], () => r(require('./zh-CN/card.md')), 'zh-CN/card')),
+ 'zh-CN/cell-swipe': wrapper(r => require.ensure([], () => r(require('./zh-CN/cell-swipe.md')), 'zh-CN/cell-swipe')),
+ 'zh-CN/cell': wrapper(r => require.ensure([], () => r(require('./zh-CN/cell.md')), 'zh-CN/cell')),
+ 'zh-CN/changelog-generated': wrapper(r => require.ensure([], () => r(require('./zh-CN/changelog-generated.md')), 'zh-CN/changelog-generated')),
+ 'zh-CN/changelog': wrapper(r => require.ensure([], () => r(require('./zh-CN/changelog.md')), 'zh-CN/changelog')),
+ 'zh-CN/checkbox': wrapper(r => require.ensure([], () => r(require('./zh-CN/checkbox.md')), 'zh-CN/checkbox')),
+ 'zh-CN/contact': wrapper(r => require.ensure([], () => r(require('./zh-CN/contact.md')), 'zh-CN/contact')),
+ 'zh-CN/coupon': wrapper(r => require.ensure([], () => r(require('./zh-CN/coupon.md')), 'zh-CN/coupon')),
+ 'zh-CN/datetime-picker': wrapper(r => require.ensure([], () => r(require('./zh-CN/datetime-picker.md')), 'zh-CN/datetime-picker')),
+ 'zh-CN/dialog': wrapper(r => require.ensure([], () => r(require('./zh-CN/dialog.md')), 'zh-CN/dialog')),
+ 'zh-CN/field': wrapper(r => require.ensure([], () => r(require('./zh-CN/field.md')), 'zh-CN/field')),
+ 'zh-CN/goods-action': wrapper(r => require.ensure([], () => r(require('./zh-CN/goods-action.md')), 'zh-CN/goods-action')),
+ 'zh-CN/icon': wrapper(r => require.ensure([], () => r(require('./zh-CN/icon.md')), 'zh-CN/icon')),
+ 'zh-CN/image-preview': wrapper(r => require.ensure([], () => r(require('./zh-CN/image-preview.md')), 'zh-CN/image-preview')),
+ 'zh-CN/layout': wrapper(r => require.ensure([], () => r(require('./zh-CN/layout.md')), 'zh-CN/layout')),
+ 'zh-CN/lazyload': wrapper(r => require.ensure([], () => r(require('./zh-CN/lazyload.md')), 'zh-CN/lazyload')),
+ 'zh-CN/loading': wrapper(r => require.ensure([], () => r(require('./zh-CN/loading.md')), 'zh-CN/loading')),
+ 'zh-CN/nav-bar': wrapper(r => require.ensure([], () => r(require('./zh-CN/nav-bar.md')), 'zh-CN/nav-bar')),
+ 'zh-CN/notice-bar': wrapper(r => require.ensure([], () => r(require('./zh-CN/notice-bar.md')), 'zh-CN/notice-bar')),
+ 'zh-CN/number-keyboard': wrapper(r => require.ensure([], () => r(require('./zh-CN/number-keyboard.md')), 'zh-CN/number-keyboard')),
+ 'zh-CN/panel': wrapper(r => require.ensure([], () => r(require('./zh-CN/panel.md')), 'zh-CN/panel')),
+ 'zh-CN/password-input': wrapper(r => require.ensure([], () => r(require('./zh-CN/password-input.md')), 'zh-CN/password-input')),
+ 'zh-CN/picker': wrapper(r => require.ensure([], () => r(require('./zh-CN/picker.md')), 'zh-CN/picker')),
+ 'zh-CN/popup': wrapper(r => require.ensure([], () => r(require('./zh-CN/popup.md')), 'zh-CN/popup')),
+ 'zh-CN/progress': wrapper(r => require.ensure([], () => r(require('./zh-CN/progress.md')), 'zh-CN/progress')),
+ 'zh-CN/pull-refresh': wrapper(r => require.ensure([], () => r(require('./zh-CN/pull-refresh.md')), 'zh-CN/pull-refresh')),
+ 'zh-CN/quickstart': wrapper(r => require.ensure([], () => r(require('./zh-CN/quickstart.md')), 'zh-CN/quickstart')),
+ 'zh-CN/radio': wrapper(r => require.ensure([], () => r(require('./zh-CN/radio.md')), 'zh-CN/radio')),
+ 'zh-CN/search': wrapper(r => require.ensure([], () => r(require('./zh-CN/search.md')), 'zh-CN/search')),
+ 'zh-CN/sku': wrapper(r => require.ensure([], () => r(require('./zh-CN/sku.md')), 'zh-CN/sku')),
+ 'zh-CN/stepper': wrapper(r => require.ensure([], () => r(require('./zh-CN/stepper.md')), 'zh-CN/stepper')),
+ 'zh-CN/steps': wrapper(r => require.ensure([], () => r(require('./zh-CN/steps.md')), 'zh-CN/steps')),
+ 'zh-CN/submit-bar': wrapper(r => require.ensure([], () => r(require('./zh-CN/submit-bar.md')), 'zh-CN/submit-bar')),
+ 'zh-CN/swipe': wrapper(r => require.ensure([], () => r(require('./zh-CN/swipe.md')), 'zh-CN/swipe')),
+ 'zh-CN/switch-cell': wrapper(r => require.ensure([], () => r(require('./zh-CN/switch-cell.md')), 'zh-CN/switch-cell')),
+ 'zh-CN/switch': wrapper(r => require.ensure([], () => r(require('./zh-CN/switch.md')), 'zh-CN/switch')),
+ 'zh-CN/tab': wrapper(r => require.ensure([], () => r(require('./zh-CN/tab.md')), 'zh-CN/tab')),
+ 'zh-CN/tabbar': wrapper(r => require.ensure([], () => r(require('./zh-CN/tabbar.md')), 'zh-CN/tabbar')),
+ 'zh-CN/tag': wrapper(r => require.ensure([], () => r(require('./zh-CN/tag.md')), 'zh-CN/tag')),
+ 'zh-CN/theme': wrapper(r => require.ensure([], () => r(require('./zh-CN/theme.md')), 'zh-CN/theme')),
+ 'zh-CN/toast': wrapper(r => require.ensure([], () => r(require('./zh-CN/toast.md')), 'zh-CN/toast')),
+ 'zh-CN/tree-select': wrapper(r => require.ensure([], () => r(require('./zh-CN/tree-select.md')), 'zh-CN/tree-select')),
+ 'zh-CN/uploader': wrapper(r => require.ensure([], () => r(require('./zh-CN/uploader.md')), 'zh-CN/uploader')),
+ 'zh-CN/waterfall': wrapper(r => require.ensure([], () => r(require('./zh-CN/waterfall.md')), 'zh-CN/waterfall')),
+ 'en-US/actionsheet': wrapper(r => require.ensure([], () => r(require('./en-US/actionsheet.md')), 'en-US/actionsheet')),
+ 'en-US/address-edit': wrapper(r => require.ensure([], () => r(require('./en-US/address-edit.md')), 'en-US/address-edit')),
+ 'en-US/address-list': wrapper(r => require.ensure([], () => r(require('./en-US/address-list.md')), 'en-US/address-list')),
+ 'en-US/area': wrapper(r => require.ensure([], () => r(require('./en-US/area.md')), 'en-US/area')),
+ 'en-US/badge': wrapper(r => require.ensure([], () => r(require('./en-US/badge.md')), 'en-US/badge')),
+ 'en-US/button': wrapper(r => require.ensure([], () => r(require('./en-US/button.md')), 'en-US/button')),
+ 'en-US/card': wrapper(r => require.ensure([], () => r(require('./en-US/card.md')), 'en-US/card')),
+ 'en-US/cell-swipe': wrapper(r => require.ensure([], () => r(require('./en-US/cell-swipe.md')), 'en-US/cell-swipe')),
+ 'en-US/cell': wrapper(r => require.ensure([], () => r(require('./en-US/cell.md')), 'en-US/cell')),
+ 'en-US/changelog': wrapper(r => require.ensure([], () => r(require('./en-US/changelog.md')), 'en-US/changelog')),
+ 'en-US/checkbox': wrapper(r => require.ensure([], () => r(require('./en-US/checkbox.md')), 'en-US/checkbox')),
+ 'en-US/contact': wrapper(r => require.ensure([], () => r(require('./en-US/contact.md')), 'en-US/contact')),
+ 'en-US/coupon': wrapper(r => require.ensure([], () => r(require('./en-US/coupon.md')), 'en-US/coupon')),
+ 'en-US/datetime-picker': wrapper(r => require.ensure([], () => r(require('./en-US/datetime-picker.md')), 'en-US/datetime-picker')),
+ 'en-US/dialog': wrapper(r => require.ensure([], () => r(require('./en-US/dialog.md')), 'en-US/dialog')),
+ 'en-US/field': wrapper(r => require.ensure([], () => r(require('./en-US/field.md')), 'en-US/field')),
+ 'en-US/goods-action': wrapper(r => require.ensure([], () => r(require('./en-US/goods-action.md')), 'en-US/goods-action')),
+ 'en-US/icon': wrapper(r => require.ensure([], () => r(require('./en-US/icon.md')), 'en-US/icon')),
+ 'en-US/image-preview': wrapper(r => require.ensure([], () => r(require('./en-US/image-preview.md')), 'en-US/image-preview')),
+ 'en-US/layout': wrapper(r => require.ensure([], () => r(require('./en-US/layout.md')), 'en-US/layout')),
+ 'en-US/lazyload': wrapper(r => require.ensure([], () => r(require('./en-US/lazyload.md')), 'en-US/lazyload')),
+ 'en-US/loading': wrapper(r => require.ensure([], () => r(require('./en-US/loading.md')), 'en-US/loading')),
+ 'en-US/nav-bar': wrapper(r => require.ensure([], () => r(require('./en-US/nav-bar.md')), 'en-US/nav-bar')),
+ 'en-US/notice-bar': wrapper(r => require.ensure([], () => r(require('./en-US/notice-bar.md')), 'en-US/notice-bar')),
+ 'en-US/number-keyboard': wrapper(r => require.ensure([], () => r(require('./en-US/number-keyboard.md')), 'en-US/number-keyboard')),
+ 'en-US/panel': wrapper(r => require.ensure([], () => r(require('./en-US/panel.md')), 'en-US/panel')),
+ 'en-US/password-input': wrapper(r => require.ensure([], () => r(require('./en-US/password-input.md')), 'en-US/password-input')),
+ 'en-US/picker': wrapper(r => require.ensure([], () => r(require('./en-US/picker.md')), 'en-US/picker')),
+ 'en-US/popup': wrapper(r => require.ensure([], () => r(require('./en-US/popup.md')), 'en-US/popup')),
+ 'en-US/progress': wrapper(r => require.ensure([], () => r(require('./en-US/progress.md')), 'en-US/progress')),
+ 'en-US/pull-refresh': wrapper(r => require.ensure([], () => r(require('./en-US/pull-refresh.md')), 'en-US/pull-refresh')),
+ 'en-US/quickstart': wrapper(r => require.ensure([], () => r(require('./en-US/quickstart.md')), 'en-US/quickstart')),
+ 'en-US/radio': wrapper(r => require.ensure([], () => r(require('./en-US/radio.md')), 'en-US/radio')),
+ 'en-US/search': wrapper(r => require.ensure([], () => r(require('./en-US/search.md')), 'en-US/search')),
+ 'en-US/sku': wrapper(r => require.ensure([], () => r(require('./en-US/sku.md')), 'en-US/sku')),
+ 'en-US/stepper': wrapper(r => require.ensure([], () => r(require('./en-US/stepper.md')), 'en-US/stepper')),
+ 'en-US/steps': wrapper(r => require.ensure([], () => r(require('./en-US/steps.md')), 'en-US/steps')),
+ 'en-US/submit-bar': wrapper(r => require.ensure([], () => r(require('./en-US/submit-bar.md')), 'en-US/submit-bar')),
+ 'en-US/swipe': wrapper(r => require.ensure([], () => r(require('./en-US/swipe.md')), 'en-US/swipe')),
+ 'en-US/switch-cell': wrapper(r => require.ensure([], () => r(require('./en-US/switch-cell.md')), 'en-US/switch-cell')),
+ 'en-US/switch': wrapper(r => require.ensure([], () => r(require('./en-US/switch.md')), 'en-US/switch')),
+ 'en-US/tab': wrapper(r => require.ensure([], () => r(require('./en-US/tab.md')), 'en-US/tab')),
+ 'en-US/tabbar': wrapper(r => require.ensure([], () => r(require('./en-US/tabbar.md')), 'en-US/tabbar')),
+ 'en-US/tag': wrapper(r => require.ensure([], () => r(require('./en-US/tag.md')), 'en-US/tag')),
+ 'en-US/theme': wrapper(r => require.ensure([], () => r(require('./en-US/theme.md')), 'en-US/theme')),
+ 'en-US/toast': wrapper(r => require.ensure([], () => r(require('./en-US/toast.md')), 'en-US/toast')),
+ 'en-US/tree-select': wrapper(r => require.ensure([], () => r(require('./en-US/tree-select.md')), 'en-US/tree-select')),
+ 'en-US/uploader': wrapper(r => require.ensure([], () => r(require('./en-US/uploader.md')), 'en-US/uploader')),
+ 'en-US/waterfall': wrapper(r => require.ensure([], () => r(require('./en-US/waterfall.md')), 'en-US/waterfall'))
+};
diff --git a/docs/markdown/zh-CN/actionsheet.md b/docs/markdown/zh-CN/actionsheet.md
new file mode 100644
index 000000000..895e44b76
--- /dev/null
+++ b/docs/markdown/zh-CN/actionsheet.md
@@ -0,0 +1,86 @@
+## Actionsheet 行动按钮
+
+### 使用指南
+``` javascript
+import { Actionsheet } from 'vant';
+
+Vue.component(Actionsheet.name, Actionsheet);
+```
+
+### 代码演示
+
+#### 基础用法
+需要传入一个`actions`的数组,数组的每一项是一个对象,对象属性见文档下方表格。
+
+```html
+
+```
+
+```javascript
+export default {
+ data() {
+ return {
+ show: false,
+ actions: [
+ {
+ name: '选项',
+ callback: this.onClick
+ },
+ {
+ name: '信用卡支付'
+ },
+ {
+ name: '选项',
+ loading: true
+ }
+ ]
+ };
+ },
+
+ methods: {
+ onClick(item) {
+ Toast(item.name);
+ }
+ }
+}
+```
+
+#### 带取消按钮的 Actionsheet
+
+如果传入了`cancelText`属性,且不为空,则会在下方显示一个取消按钮,点击会将当前`Actionsheet`关闭。
+
+```html
+
+```
+
+#### 带标题的 Actionsheet
+
+如果传入了`title`属性,且不为空,则另外一种样式的`Actionsheet`,里面内容需要自定义。
+
+```html
+
+ 一些内容
+
+```
+
+### API
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| actions | 行动按钮数组 | `Array` | `[]` | - |
+| title | 标题 | `String` | - | - |
+| cancelText | 取消按钮文案 | `String` | - | - |
+| overlay | 是否显示遮罩 | `Boolean` | - | - |
+| closeOnClickOverlay | 点击遮罩是否关闭`Actionsheet` | `Boolean` | - | - |
+
+### actions
+
+`API`中的`actions`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`:
+
+| key | 说明 |
+|-----------|-----------|
+| name | 标题 |
+| subname | 二级标题 |
+| className | 为对应列添加特殊的`class` |
+| loading | 是否是`loading`状态 |
+| callback | 点击时的回调。该回调接受一个参数,参数为当前点击`action`的对象信息 |
diff --git a/docs/examples-docs/zh-CN/address-edit.md b/docs/markdown/zh-CN/address-edit.md
similarity index 75%
rename from docs/examples-docs/zh-CN/address-edit.md
rename to docs/markdown/zh-CN/address-edit.md
index 2fd6144d7..99a772285 100644
--- a/docs/examples-docs/zh-CN/address-edit.md
+++ b/docs/markdown/zh-CN/address-edit.md
@@ -1,41 +1,3 @@
-
-
## AddressEdit 地址编辑
### 使用指南
@@ -49,14 +11,13 @@ Vue.component(AddressEdit.name, AddressEdit);
#### 基础用法
-:::demo 基础用法
```html
-import { Toast } from 'packages';
-
-export default {
- data() {
- return {
- chosenAddressId: '1',
- list: [
- {
- id: '1',
- name: '张三',
- tel: '13000000000',
- address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室'
- },
- {
- id: '2',
- name: '李四',
- tel: '1310000000',
- address: '浙江省杭州市拱墅区莫干山路 50 号'
- },
- {
- id: '3',
- name: '王五',
- tel: '1320000000',
- address: '浙江省杭州市滨江区江南大道 15 号'
- }
- ]
- }
- },
-
- methods: {
- onAdd() {
- Toast('新增收货地址');
- },
- onEdit(item, index) {
- Toast('编辑收货地址:' + index);
- }
- }
-}
-
-
## AddressList 地址列表
### 使用指南
@@ -52,7 +11,6 @@ Vue.component(AddressList.name, AddressList);
#### 基础用法
-:::demo 基础用法
```html
-import AreaList from '../../mock/area.json';
-
-export default {
- data() {
- return {
- areaList: AreaList
- }
- }
-};
-
-
## Area 省市县选择组件
### 使用指南
@@ -26,43 +14,27 @@ Vue.component(Area.name, Area);
要初始化一个`Area`组件,你需要传入一个`areaList`属性,`areaList`数据格式具体可看下面数据格式章节。
-:::demo 基础用法
```html
-
-
-
+
```
-:::
+
#### 选中省市县
如果想选中某个省市县,需要传入一个`value`属性,绑定对应的省市县`code`。
-:::demo 选中省市县
```html
-
+
```
-:::
+
#### 配置显示列
可以通过`columnsNum`属性配置省市县显示的列数,默认情况下会显示省市县,当你设置为`2`,则只会显示省市选择。
-:::demo 配置显示列
```html
-
+
```
-:::
### API
@@ -115,7 +87,7 @@ export default {
}
```
-完整数据见 [Area.json](https://github.com/youzan/vant/blob/dev/docs/mock/area.json)
+完整数据见 [Area.json](https://github.com/youzan/vant/blob/dev/docs/demos/mock/area.json)
#### 点击完成时返回的数据格式
返回的数据整体为一个数组,数组内包含 `columnsNum` 个数据, 每个数据对应一列选项中被选中的数据。
diff --git a/docs/examples-docs/zh-CN/badge.md b/docs/markdown/zh-CN/badge.md
similarity index 73%
rename from docs/examples-docs/zh-CN/badge.md
rename to docs/markdown/zh-CN/badge.md
index 3fed127a1..028f52388 100644
--- a/docs/examples-docs/zh-CN/badge.md
+++ b/docs/markdown/zh-CN/badge.md
@@ -1,38 +1,3 @@
-
-
-
-
## Badge 徽章
### 使用指南
@@ -48,7 +13,6 @@ Vue.component(Badge.name, Badge);
通过在`van-badge-group`上设置`active-key`属性来控制选中的`badge`
-:::demo 基础用法
```html
@@ -72,8 +36,6 @@ export default {
}
};
```
-:::
-
### BadgeGroup API
diff --git a/docs/examples-docs/zh-CN/button.md b/docs/markdown/zh-CN/button.md
similarity index 73%
rename from docs/examples-docs/zh-CN/button.md
rename to docs/markdown/zh-CN/button.md
index f434a7192..b9715e8a5 100644
--- a/docs/examples-docs/zh-CN/button.md
+++ b/docs/markdown/zh-CN/button.md
@@ -1,29 +1,3 @@
-
-
## Button 按钮
### 使用指南
@@ -39,74 +13,62 @@ Vue.component(Button.name, Button);
支持`default`、`primary`、`danger`三种类型,默认为`default`
-:::demo 按钮类型
```html
Default
Primary
Danger
```
-:::
#### 按钮尺寸
支持`large`、`normal`、`small`、`mini`四种尺寸,默认为`normal`
-:::demo 按钮尺寸
```html
Large
Normal
Small
Mini
```
-:::
#### 禁用状态
通过`disabled`属性来禁用按钮,此时按钮不可点击
-:::demo 禁用状态
```html
Diabled
```
-:::
#### 加载状态
-:::demo 加载状态
```html
```
-:::
#### 自定义按钮标签
按钮标签默认为`button`,可以使用`tag`属性来修改按钮标签
-:::demo 自定义按钮标签
```html
- a 标签按钮
+ 按钮
```
-:::
#### 页面底部操作按钮
-:::demo 页面底部操作按钮
```html
-立即购买
+按钮
- 加入购物车
+ 按钮
- 立即购买
+ 按钮
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/card.md b/docs/markdown/zh-CN/card.md
similarity index 71%
rename from docs/examples-docs/zh-CN/card.md
rename to docs/markdown/zh-CN/card.md
index a018bc09b..68d13f7a1 100644
--- a/docs/examples-docs/zh-CN/card.md
+++ b/docs/markdown/zh-CN/card.md
@@ -1,13 +1,3 @@
-
-
## Card 卡片
### 使用指南
@@ -21,37 +11,33 @@ Vue.component(Card.name, Card);
#### 基础用法
-:::demo 基础用法
```html
```
-:::
#### 高级用法
可以通过具名`slot`添加定制内容
-:::demo 高级用法
```html
- 按钮一
- 按钮二
+ 按钮
+ 按钮
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/cell-swipe.md b/docs/markdown/zh-CN/cell-swipe.md
similarity index 64%
rename from docs/examples-docs/zh-CN/cell-swipe.md
rename to docs/markdown/zh-CN/cell-swipe.md
index e08ceadeb..4cabcc0bb 100644
--- a/docs/examples-docs/zh-CN/cell-swipe.md
+++ b/docs/markdown/zh-CN/cell-swipe.md
@@ -1,21 +1,3 @@
-
## CellSwipe 滑动单元格
### 使用指南
@@ -29,17 +11,15 @@ Vue.component(CellSwipe.name, CellSwipe);
#### 基础用法
-:::demo 基础用法
```html
选择
-
+
删除
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/cell.md b/docs/markdown/zh-CN/cell.md
similarity index 65%
rename from docs/examples-docs/zh-CN/cell.md
rename to docs/markdown/zh-CN/cell.md
index 836deac47..c942c90ed 100644
--- a/docs/examples-docs/zh-CN/cell.md
+++ b/docs/markdown/zh-CN/cell.md
@@ -1,28 +1,3 @@
-
-
-
-
## Cell 单元格
### 使用指南
@@ -39,69 +14,61 @@ Vue.component(CellGroup.name, CellGroup);
将`van-cell-group`组件看成一个容器即可
-:::demo 基础用法
```html
-
-
+
+
```
-:::
#### 只设置value
只设置`value`时会向左对齐
-:::demo 只设置value
```html
-
+
```
-:::
#### 展示图标
通过`icon`属性在标题左侧展示图标
-:::demo 展示图标
+
```html
```
-:::
+
#### 展示箭头
传入`isLink`属性则会在右侧显示箭头
-:::demo 展示箭头
```html
-
-
+
+
```
-:::
#### 高级用法
如以上用法不能满足你的需求,可以使用对应的`slot`来自定义显示的内容
-:::demo 高级用法
```html
-
+
- 起码运动馆
- 官方
+ 单元格
+ 标签
-
-
+
+
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/changelog-generated.md b/docs/markdown/zh-CN/changelog-generated.md
similarity index 100%
rename from docs/examples-docs/zh-CN/changelog-generated.md
rename to docs/markdown/zh-CN/changelog-generated.md
diff --git a/docs/examples-docs/zh-CN/changelog.md b/docs/markdown/zh-CN/changelog.md
similarity index 99%
rename from docs/examples-docs/zh-CN/changelog.md
rename to docs/markdown/zh-CN/changelog.md
index 5a31a5180..b69b29b9d 100644
--- a/docs/examples-docs/zh-CN/changelog.md
+++ b/docs/markdown/zh-CN/changelog.md
@@ -4,12 +4,10 @@
`2017-11-15`
**Improvements**
-
-- Icon: 增加几个新 icons [\#315](https://github.com/youzan/vant/pull/315) ([cookfront](https://github.com/cookfront))
+- Icon: 增加几个新 icons [\#315](https://github.com/youzan/vant/pull/315) [@cookfront](https://github.com/cookfront)
**Bug Fixes**
-
-- Search: 修复 box-sizing wrong [\#312](https://github.com/youzan/vant/pull/312) ([chenjiahan](https://github.com/chenjiahan))
+- Search: 修复 box-sizing 错误 [\#312](https://github.com/youzan/vant/pull/312) [@chenjiahan](https://github.com/chenjiahan)
### [0.10.8](https://github.com/youzan/vant/tree/v0.10.8)
`2017-11-11`
diff --git a/docs/examples-docs/zh-CN/checkbox.md b/docs/markdown/zh-CN/checkbox.md
similarity index 72%
rename from docs/examples-docs/zh-CN/checkbox.md
rename to docs/markdown/zh-CN/checkbox.md
index 3be84ba8d..cd220c5ec 100644
--- a/docs/examples-docs/zh-CN/checkbox.md
+++ b/docs/markdown/zh-CN/checkbox.md
@@ -1,33 +1,3 @@
-
-
-
-
## Checkbox 复选框
### 使用指南
@@ -43,35 +13,30 @@ Vue.component(CheckboxGroup.name, CheckboxGroup);
#### 基础用法
通过`v-model`绑定 checkbox 的勾选状态
-:::demo 基础用法
```html
-复选框 1
+复选框 1
```
```javascript
export default {
data() {
return {
- checkbox1: true
+ checked: true
};
}
};
```
-:::
#### 禁用状态
-:::demo 禁用状态
```html
-复选框 2
+复选框 2
```
-:::
#### Checkbox 组
需要与`van-checkbox-group`一起使用,选中值是一个数组,通过`v-model`绑定在`van-checkbox-group`上,数组中的项即为选中的`Checkbox`的`name`属性设置的值
-:::demo Checkbox 组
```html
- 复选框{{ item }}
+ 复选框 {{ item }}
```
-```javascript
-export default {
- data() {
- return {
- list: ['a', 'b', 'c'],
- result: ['a', 'b']
- };
- }
-};
-```
-:::
-
### Checkbox API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
diff --git a/docs/examples-docs/zh-CN/contact.md b/docs/markdown/zh-CN/contact.md
similarity index 73%
rename from docs/examples-docs/zh-CN/contact.md
rename to docs/markdown/zh-CN/contact.md
index f32f46aa0..cd50b857b 100644
--- a/docs/examples-docs/zh-CN/contact.md
+++ b/docs/markdown/zh-CN/contact.md
@@ -1,79 +1,3 @@
-
-
-
-
## Contact 联系人
通过 Contact 组件可以实现联系人的展示、选择、编辑等功能。
@@ -90,7 +14,6 @@ Vue.component(ContactEdit.name, ContactEdit);
#### 基础用法
-:::demo 基础用法
```html
+/>
@@ -114,8 +37,8 @@ Vue.component(ContactEdit.name, ContactEdit);
@@ -194,7 +117,7 @@ export default {
}
};
```
-:::
+
### ContactCard API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
diff --git a/docs/examples-docs/zh-CN/coupon.md b/docs/markdown/zh-CN/coupon.md
similarity index 72%
rename from docs/examples-docs/zh-CN/coupon.md
rename to docs/markdown/zh-CN/coupon.md
index 92048fb57..18e16e83c 100644
--- a/docs/examples-docs/zh-CN/coupon.md
+++ b/docs/markdown/zh-CN/coupon.md
@@ -1,71 +1,3 @@
-
-
-
-
## Coupon 优惠券选择器
### 使用指南
@@ -80,24 +12,23 @@ Vue.component(CouponList.name, CouponList);
#### 基础用法
-:::demo 基础用法
```html
+/>
+ />
```
@@ -135,7 +66,7 @@ export default {
}
}
```
-:::
+
### CouponCell API
diff --git a/docs/examples-docs/zh-CN/datetime-picker.md b/docs/markdown/zh-CN/datetime-picker.md
similarity index 74%
rename from docs/examples-docs/zh-CN/datetime-picker.md
rename to docs/markdown/zh-CN/datetime-picker.md
index 7d664da50..a9c0116af 100644
--- a/docs/examples-docs/zh-CN/datetime-picker.md
+++ b/docs/markdown/zh-CN/datetime-picker.md
@@ -1,21 +1,3 @@
-
-
## DatetimePicker 时间选择
### 使用指南
@@ -29,15 +11,14 @@ Vue.component(DatetimePicker.name, DatetimePicker);
#### 基础用法
-:::demo 基础用法
```html
```
@@ -54,36 +35,30 @@ export default {
}
};
```
-:::
#### 选择日期
-:::demo 选择日期
```html
```
-:::
#### 选择时间
-:::demo 选择时间
```html
```
-:::
-
### API
diff --git a/docs/markdown/zh-CN/dialog.md b/docs/markdown/zh-CN/dialog.md
new file mode 100644
index 000000000..eac30892c
--- /dev/null
+++ b/docs/markdown/zh-CN/dialog.md
@@ -0,0 +1,63 @@
+## Dialog 弹出框
+
+### 使用指南
+
+```js
+import { Dialog } from 'vant';
+```
+
+### 代码演示
+
+#### 消息提示
+用于提示一些消息,只包含一个确认按钮
+
+```javascript
+Dialog.alert({
+ title: '标题',
+ message: '弹窗内容'
+}).then(() => {
+ // on close
+});
+
+Dialog.alert({
+ message: '弹窗内容'
+}).then(() => {
+ // on close
+});
+```
+
+#### 消息确认
+用于确认消息,包含取消和确认按钮
+
+```javascript
+Dialog.confirm({
+ title: '标题',
+ message: '弹窗内容'
+}).then(() => {
+ // on confirm
+}).catch(() => {
+ // on cancel
+});
+```
+
+### 方法
+
+| 方法名 | 参数 | 返回值 | 介绍 |
+|-----------|-----------|-----------|-------------|
+| Dialog.alert | options | `Promise` | 展示消息提示弹窗 |
+| Dialog.confirm | options | `Promise` | 展示消息确认弹窗 |
+| Dialog.close | - | `void` | 关闭弹窗 |
+
+### Options
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| title | 标题 | `String` | - | - |
+| message | 内容 | `String` | - | - |
+| showConfirmButton | 是否展示确认按钮 | `Boolean` | `true` | - |
+| showCancelButton | 是否展示取消按钮 | `Boolean` | `false` | - |
+| confirmButtonText | 确认按钮的文案 | `String` | `确认` | - |
+| cancelButtonText | 取消按钮的文案 | `String` | `取消` | - |
+| overlay | 是否展示蒙层 | `Boolean` | `true` | - |
+| closeOnClickOverlay | 点击蒙层时是否关闭弹窗 | `Boolean` | `false` | - |
+| lockOnScroll | 是否禁用背景滚动 | `Boolean` | `true` | - |
diff --git a/docs/examples-docs/zh-CN/field.md b/docs/markdown/zh-CN/field.md
similarity index 87%
rename from docs/examples-docs/zh-CN/field.md
rename to docs/markdown/zh-CN/field.md
index ae9d029a4..afa974146 100644
--- a/docs/examples-docs/zh-CN/field.md
+++ b/docs/markdown/zh-CN/field.md
@@ -1,22 +1,3 @@
-
-
-
-
## Field 输入框
`input`或`textarea`的输入框。
@@ -33,18 +14,15 @@ Vue.component(Field.name, Field);
#### 基础用法
通过 v-model 绑定输入框的值
-:::demo 基础用法
```html
```
-:::
#### 自定义类型
根据`type`属性定义不同类型的输入框
-:::demo 自定义类型
```html
```
-:::
#### 禁用输入框
-:::demo 禁用输入框
```html
```
-:::
#### 错误提示
-:::demo 错误提示
```html
```
-:::
#### 高度自适应
对于 textarea,可以通过`autosize`属性设置高度自适应
-:::demo 高度自适应
```html
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/goods-action.md b/docs/markdown/zh-CN/goods-action.md
similarity index 83%
rename from docs/examples-docs/zh-CN/goods-action.md
rename to docs/markdown/zh-CN/goods-action.md
index 04fd34455..11689051c 100644
--- a/docs/examples-docs/zh-CN/goods-action.md
+++ b/docs/markdown/zh-CN/goods-action.md
@@ -1,26 +1,3 @@
-
-
-
-
## GoodsAction 商品页行动点
### 使用指南
@@ -38,7 +15,6 @@ Vue.component(GoodsActionMiniBtn.name, GoodsActionMiniBtn);
### 代码演示
-:::demo
```html
@@ -68,7 +44,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/markdown/zh-CN/icon.md b/docs/markdown/zh-CN/icon.md
new file mode 100644
index 000000000..b92eb7a05
--- /dev/null
+++ b/docs/markdown/zh-CN/icon.md
@@ -0,0 +1,23 @@
+## Icon 图标
+
+### 使用指南
+``` javascript
+import { Icon } from 'vant';
+
+Vue.component(Icon.name, Icon);
+```
+
+### 代码演示
+
+#### 基础用法
+设置`name`属性为对应的图标名称即可,所有可用的图标名称见右侧列表
+
+```html
+
+```
+
+### API
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| name | icon名称 | `String` | `''` | - |
diff --git a/docs/markdown/zh-CN/image-preview.md b/docs/markdown/zh-CN/image-preview.md
new file mode 100644
index 000000000..539965323
--- /dev/null
+++ b/docs/markdown/zh-CN/image-preview.md
@@ -0,0 +1,36 @@
+## ImagePreview 图片预览
+
+### 使用指南
+
+`ImagePreview`和其他组件不同,不是通过HTML结构的方式来使用,而是通过函数调用的方式。使用前需要先引入它。
+
+```js
+import { ImagePreview } from 'vant';
+```
+
+### 代码演示
+
+#### 基础用法
+
+```javascript
+ImagePreview([
+ 'https://img.yzcdn.cn/1.jpg',
+ 'https://img.yzcdn.cn/2.jpg'
+]);
+```
+
+#### 指定初始位置
+
+```javascript
+ImagePreview([
+ 'https://img.yzcdn.cn/1.jpg',
+ 'https://img.yzcdn.cn/2.jpg'
+], 1);
+```
+
+### 方法参数
+
+| 参数名 | 说明 | 类型 |
+|-----------|-----------|-----------|
+| imageUrls | 需要预览的图片 | `Array` |
+| startPosition | 图片预览起始位置索引 | `Number` |
diff --git a/docs/examples-docs/zh-CN/layout.md b/docs/markdown/zh-CN/layout.md
similarity index 79%
rename from docs/examples-docs/zh-CN/layout.md
rename to docs/markdown/zh-CN/layout.md
index 9256c40b0..c9a01eb4a 100644
--- a/docs/examples-docs/zh-CN/layout.md
+++ b/docs/markdown/zh-CN/layout.md
@@ -1,27 +1,3 @@
-
-
## Layout 布局
提供了`van-row`和`van-col`两个组件来进行行列布局
@@ -41,7 +17,6 @@ Vue.component(Col.name, Col);
Layout 组件提供了`24列栅格`,通过在`Col`上添加`span`属性设置列所占的宽度百分比
此外,添加`offset`属性可以设置列的偏移宽度,计算方式与 span 相同
-:::demo 基本用法
```html
span: 8
@@ -58,13 +33,11 @@ Layout 组件提供了`24列栅格`,通过在`Col`上添加`span`属性设置
offset: 12, span: 12
```
-:::
#### 设置列元素间距
通过`gutter`属性可以设置列元素之间的间距,默认间距为 0
-:::demo 在列元素之间增加间距
```html
span: 8
@@ -72,7 +45,6 @@ Layout 组件提供了`24列栅格`,通过在`Col`上添加`span`属性设置
span: 8
```
-:::
### API
diff --git a/docs/markdown/zh-CN/lazyload.md b/docs/markdown/zh-CN/lazyload.md
new file mode 100644
index 000000000..a6b235495
--- /dev/null
+++ b/docs/markdown/zh-CN/lazyload.md
@@ -0,0 +1,67 @@
+## Lazyload 图片懒加载
+
+### 使用指南
+
+`Lazyload`是`Vue`指令,所以需要使用它必须将它注册到`Vue`的指令中。
+
+```js
+import Vue from 'vue';
+import { Lazyload } from 'vant';
+
+Vue.use(Lazyload, options);
+```
+
+### 代码演示
+
+#### 基础用法
+将`v-lazy`指令的值设置为你需要懒加载的图片
+
+```html
+
+```
+
+```javascript
+export default {
+ data() {
+ return {
+ imageList: [
+ 'https://img.yzcdn.cn/1.jpg',
+ 'https://img.yzcdn.cn/2.jpg'
+ ]
+ };
+ }
+}
+```
+
+#### 背景图懒加载
+
+和图片懒加载不同,背景图懒加载需要使用`v-lazy:background-image`,值设置为背景图片的地址,需要注意的是必须声明容器高度。
+
+```html
+
+```
+
+#### 懒加载模块
+
+懒加载模块需要使用到`lazy-component`,将需要懒加载的内容放在`lazy-component`中即可。
+
+```html
+
+
+
+```
+
+### Options
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| loading | 加载时的图片 | `String` | - | - |
+| error | 错误时的图片 | `String` | - | - |
+| preload | 预加载高度的比例 | `String` | - | - |
+| attempt | 尝试次数 | `Number` | `3` | - |
+| listenEvents | 监听的事件 | `Array` | `scroll`等 | - |
+| adapter | 适配器 | `Object` | - | - |
+| filter | 图片url过滤 | `Object` | - | - |
+| lazyComponent | 是否能懒加载模块 | `Boolean` | `false` | - |
+
+更多内容请参照:[ vue-lazyload 官方文档](https://github.com/hilongjw/vue-lazyload)
diff --git a/docs/markdown/zh-CN/loading.md b/docs/markdown/zh-CN/loading.md
new file mode 100644
index 000000000..dda2c6e03
--- /dev/null
+++ b/docs/markdown/zh-CN/loading.md
@@ -0,0 +1,38 @@
+## Loading 加载
+
+### 使用指南
+``` javascript
+import { Loading } from 'vant';
+
+Vue.component(Loading.name, Loading);
+```
+
+### 代码演示
+
+#### 单色圆环
+
+```html
+
+
+```
+
+#### 渐变色圆环
+
+```html
+
+
+```
+
+#### Spinner
+
+```html
+
+
+```
+
+### API
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| color | 颜色 | `String` | `black` | `black` `white` |
+| type | 类型 | `String` | `gradient-circle` | `spinner` `circle` |
diff --git a/docs/examples-docs/zh-CN/nav-bar.md b/docs/markdown/zh-CN/nav-bar.md
similarity index 67%
rename from docs/examples-docs/zh-CN/nav-bar.md
rename to docs/markdown/zh-CN/nav-bar.md
index cfa355e70..ae5c48fea 100644
--- a/docs/examples-docs/zh-CN/nav-bar.md
+++ b/docs/markdown/zh-CN/nav-bar.md
@@ -11,36 +11,32 @@ Vue.component(NavBar.name, NavBar);
#### 基础用法
-:::demo 基础用法
```html
```
-:::
#### 高级用法
通过 slot 定制内容
-:::demo 高级用法
```html
-
+
```
-:::
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|-----------|-----------|-----------|-------------|-------------|
| title | 标题 | `String` | `''` | - |
-| left-text | 左侧文案 | `String` | `''` | - |
-| right-text | 右侧文案 | `String` | `''` | - |
-| left-arrow | 是否显示左侧箭头 | `Boolean` | `false` | - |
+| leftText | 左侧文案 | `String` | `''` | - |
+| rightText | 右侧文案 | `String` | `''` | - |
+| leftArrow | 是否显示左侧箭头 | `Boolean` | `false` | - |
| fixed | 是否固定在顶部 | `Boolean` | `false` | - |
### Slot
diff --git a/docs/examples-docs/zh-CN/notice-bar.md b/docs/markdown/zh-CN/notice-bar.md
similarity index 84%
rename from docs/examples-docs/zh-CN/notice-bar.md
rename to docs/markdown/zh-CN/notice-bar.md
index 4eaeccbfb..b96abfd98 100644
--- a/docs/examples-docs/zh-CN/notice-bar.md
+++ b/docs/markdown/zh-CN/notice-bar.md
@@ -1,11 +1,3 @@
-
-
## NoticeBar 通告栏
### 使用指南
@@ -19,31 +11,25 @@ Vue.component(NoticeBar.name, NoticeBar);
#### 基础用法
-:::demo 基础用法
```html
-
```
-:::
#### 禁用滚动
文字内容多于一行时,可通过`scrollable`参数控制是否开启滚动
-:::demo 禁用滚动
```html
足协杯战线连续第2年上演广州德比战,上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。
```
-:::
#### 通告栏模式
默认模式为空,支持`closeable`和`link`。
-:::demo 通告栏模式
```html
@@ -55,7 +41,6 @@ Vue.component(NoticeBar.name, NoticeBar);
足协杯战线连续第2年上演广州德比战,上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/number-keyboard.md b/docs/markdown/zh-CN/number-keyboard.md
similarity index 80%
rename from docs/examples-docs/zh-CN/number-keyboard.md
rename to docs/markdown/zh-CN/number-keyboard.md
index 427a12c7e..fe0fed0a5 100644
--- a/docs/examples-docs/zh-CN/number-keyboard.md
+++ b/docs/markdown/zh-CN/number-keyboard.md
@@ -1,32 +1,3 @@
-
-
-
-
## NumberKeyboard 数字键盘
### 使用指南
@@ -40,7 +11,6 @@ Vue.component(NumberKeyboard.name, NumberKeyboard);
#### 基础用法
-:::demo 基础用法
```html
弹出键盘
@@ -76,8 +46,6 @@ export default {
}
}
```
-:::
-
### API
diff --git a/docs/examples-docs/zh-CN/panel.md b/docs/markdown/zh-CN/panel.md
similarity index 58%
rename from docs/examples-docs/zh-CN/panel.md
rename to docs/markdown/zh-CN/panel.md
index b4647334c..6657748a8 100644
--- a/docs/examples-docs/zh-CN/panel.md
+++ b/docs/markdown/zh-CN/panel.md
@@ -1,19 +1,3 @@
-
-
## Panel 面板
### 使用指南
@@ -28,28 +12,24 @@ Vue.component(Panel.name, Panel);
#### 基础用法
面板只是一个容器,里面可以放入自定义的内容
-:::demo 基础用法
```html
-
- Panel内容
+
+ 内容
```
-:::
#### 高级用法
使用`slot`自定义内容
-:::demo 高级用法
```html
-
- Panel内容
+
+ 内容
- 按钮一
- 按钮二
+ 按钮
+ 按钮
```
-:::
### API
@@ -59,7 +39,6 @@ Vue.component(Panel.name, Panel);
| desc | 描述 | `String` | - | - |
| status | 状态 | `String` | - | - |
-
### Slot
| name | 描述 |
diff --git a/docs/examples-docs/zh-CN/password-input.md b/docs/markdown/zh-CN/password-input.md
similarity index 78%
rename from docs/examples-docs/zh-CN/password-input.md
rename to docs/markdown/zh-CN/password-input.md
index 56ddb58b4..70313ba0b 100644
--- a/docs/examples-docs/zh-CN/password-input.md
+++ b/docs/markdown/zh-CN/password-input.md
@@ -1,23 +1,3 @@
-
-
## PasswordInput 密码输入框
密码输入框组件通常与 [数字键盘](#/zh-CN/component/number-keyboard) 组件配合使用
@@ -33,14 +13,13 @@ Vue.component(NumberKeyBoard.name, NumberKeyBoard);
#### 基础用法
-:::demo 基础用法
```html
+/>
+/>
```
```javascript
@@ -57,7 +36,7 @@ export default {
return {
value: '',
showKeyboard: true
- }
+ };
},
methods: {
@@ -70,7 +49,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/picker.md b/docs/markdown/zh-CN/picker.md
similarity index 53%
rename from docs/examples-docs/zh-CN/picker.md
rename to docs/markdown/zh-CN/picker.md
index e02b85dad..83a4ff41a 100644
--- a/docs/examples-docs/zh-CN/picker.md
+++ b/docs/markdown/zh-CN/picker.md
@@ -1,43 +1,3 @@
-
-
## Picker 选择器
### 使用指南
@@ -51,16 +11,14 @@ Vue.component(Picker.name, Picker);
#### 基础用法
-:::demo 基础用法
```html
-
+
```
```javascript
const citys = {
- '浙江': ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州', '舟山', '台州', '丽水'],
- '福建': ['福州', '厦门', '莆田', '三明', '泉州', '漳州', '南平', '龙岩', '宁德'],
- '湖南': ['长沙', '株洲', '湘潭', '衡阳', '邵阳', '岳阳', '常德', '张家界', '益阳', '郴州', '永州', '怀化', '娄底', '湘西土家族苗族自治州']
+ '浙江': ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州'],
+ '福建': ['福州', '厦门', '莆田', '三明', '泉州', '漳州', '南平', '龙岩']
};
export default {
@@ -72,7 +30,7 @@ export default {
className: 'column1'
},
{
- values: ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州', '舟山', '台州', '丽水'],
+ values: citys['浙江'],
className: 'column2'
}
]
@@ -80,33 +38,30 @@ export default {
},
methods: {
- handlePickerChange(picker, values) {
+ onChange(picker, values) {
picker.setColumnValues(1, citys[values[0]]);
}
}
};
```
-:::
-#### 带toolbar的Picker
+#### 带 toolbar 的 Picker
-:::demo 带toolbar的Picker
```html
+ @change="onChange"
+ @cancel="onCancel"
+ @confirm="onConfirm"
+/>
```
```javascript
const citys = {
- '浙江': ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州', '舟山', '台州', '丽水'],
- '福建': ['福州', '厦门', '莆田', '三明', '泉州', '漳州', '南平', '龙岩', '宁德'],
- '湖南': ['长沙', '株洲', '湘潭', '衡阳', '邵阳', '岳阳', '常德', '张家界', '益阳', '郴州', '永州', '怀化', '娄底', '湘西土家族苗族自治州']
+ '浙江': ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州'],
+ '福建': ['福州', '厦门', '莆田', '三明', '泉州', '漳州', '南平', '龙岩']
};
export default {
@@ -119,7 +74,7 @@ export default {
className: 'column1'
},
{
- values: ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州', '舟山', '台州', '丽水'],
+ values: citys['浙江'],
className: 'column2'
}
]
@@ -127,19 +82,18 @@ export default {
},
methods: {
- handlePickerChange(picker, values) {
+ onChange(picker, values) {
picker.setColumnValues(1, citys[values[0]]);
},
- handlePickerCancel() {
- alert('picker cancel');
+ onCancel() {
+ Toast('picker cancel');
},
- handlePickerConfirm() {
- alert('picker confirm');
+ onConfirm() {
+ Toast('picker confirm');
}
}
};
```
-:::
### API
diff --git a/docs/markdown/zh-CN/popup.md b/docs/markdown/zh-CN/popup.md
new file mode 100644
index 000000000..7492131b1
--- /dev/null
+++ b/docs/markdown/zh-CN/popup.md
@@ -0,0 +1,48 @@
+## Popup 弹出层
+
+### 使用指南
+``` javascript
+import { Popup } from 'vant';
+
+Vue.component(Popup.name, Popup);
+```
+
+### 代码演示
+
+#### 基础用法
+`popup`默认从中间弹出
+
+```html
+内容
+```
+
+```javascript
+export default {
+ data() {
+ return {
+ show: false
+ }
+ }
+};
+```
+
+#### 弹出位置
+通过`position`属性设置 Popup 弹出位置
+
+```html
+
+ 内容
+
+```
+
+### API
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| v-model | 当前组件是否显示 | `Boolean` | `false` | - |
+| overlay | 是否显示背景遮罩层 | `Boolean` | `true` | - |
+| lockOnScroll | 背景是否跟随滚动 | `Boolean` | `false` | - |
+| position | 弹出层位置 | `String` | - | `top` `bottom` `right` `left` |
+| closeOnClickOverlay | 点击遮罩层是否关闭弹出层 | `Boolean` | `true` | - |
+| transition | 弹出层的`transition` | `String` | `popup-slide` | - |
+| preventScroll | 是否防止滚动穿透 | `Boolean` | `false` | - |
diff --git a/docs/examples-docs/zh-CN/progress.md b/docs/markdown/zh-CN/progress.md
similarity index 50%
rename from docs/examples-docs/zh-CN/progress.md
rename to docs/markdown/zh-CN/progress.md
index 1f7a0314c..d31c09377 100644
--- a/docs/examples-docs/zh-CN/progress.md
+++ b/docs/markdown/zh-CN/progress.md
@@ -1,11 +1,3 @@
-
-
## Progress 进度条
### 使用指南
@@ -21,37 +13,31 @@ Vue.component(Progress.name, Progress);
进度条默认为蓝色,使用`percentage`属性来设置当前进度
-:::demo 基础用法
```html
-
-
-
+
+
+
```
-:::
#### 进度条置灰
-:::demo 进度条置灰
```html
-
-
-
+
+
+
```
-:::
#### 样式定制
-可以使用`pivot-text`属性自定义文字,`color`属性自定义进度条颜色
+可以使用`pivotText`属性自定义文字,`color`属性自定义进度条颜色
-:::demo 样式定制
```html
-
-
-
+
+
+
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/pull-refresh.md b/docs/markdown/zh-CN/pull-refresh.md
similarity index 61%
rename from docs/examples-docs/zh-CN/pull-refresh.md
rename to docs/markdown/zh-CN/pull-refresh.md
index 3326d651d..cb6ad0f7d 100644
--- a/docs/examples-docs/zh-CN/pull-refresh.md
+++ b/docs/markdown/zh-CN/pull-refresh.md
@@ -1,55 +1,3 @@
-
-
-
-
## PullRefresh 下拉刷新
### 使用指南
@@ -61,7 +9,6 @@ Vue.component(PullRefresh.name, PullRefresh);
### 代码演示
-:::demo
```html
@@ -91,7 +38,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/quickstart.md b/docs/markdown/zh-CN/quickstart.md
similarity index 100%
rename from docs/examples-docs/zh-CN/quickstart.md
rename to docs/markdown/zh-CN/quickstart.md
diff --git a/docs/examples-docs/zh-CN/radio.md b/docs/markdown/zh-CN/radio.md
similarity index 50%
rename from docs/examples-docs/zh-CN/radio.md
rename to docs/markdown/zh-CN/radio.md
index 8823f92dd..2bea771d3 100644
--- a/docs/examples-docs/zh-CN/radio.md
+++ b/docs/markdown/zh-CN/radio.md
@@ -1,28 +1,3 @@
-
-
-
-
## Radio 单选框
### 使用指南
@@ -38,97 +13,55 @@ Vue.component(Radio.name, Radio);
通过`v-model`绑定值即可。当`Radio`选中时,绑定的值即为`Radio`中`name`属性设置的值。
-:::demo 基础用法
```html
-
- 单选框 1
- 单选框 2
-
+单选框 1
+单选框 2
```
+
```javascript
export default {
data() {
return {
- radio1: '1'
+ radio: '1'
}
}
};
```
-:::
#### 禁用状态
设置`disabled`属性即可,此时`Radio`不能点击。
-:::demo 禁用状态
```html
-
- 未选中禁用
- 选中且禁用
-
+未选中禁用
+选中且禁用
```
-```javascript
-export default {
- data() {
- return {
- radio2: '2'
- }
- }
-};
-```
-:::
-#### radio组
+#### Radio 组
需要与`van-radio-group`一起使用,在`van-radio-group`通过`v-model`来绑定当前选中的值。例如下面的`radio3`:
-:::demo radio组
```html
-
-
- 单选框 1
- 单选框 2
-
-
+
+ 单选框 1
+ 单选框 2
+
```
-
-```javascript
-export default {
- data() {
- return {
- radio3: '1'
- }
- }
-};
-```
-:::
#### 与 Cell 组件一起使用
此时你需要再引入`Cell`和`CellGroup`组件。
-:::demo 与 Cell 组件一起使用
```html
-
+
- 单选框1
- 单选框2
+ 单选框 1
+ 单选框 2
```
-```javascript
-export default {
- data() {
- return {
- radio4: '1'
- }
- }
-};
-```
-:::
-
### Radio API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
diff --git a/docs/examples-docs/zh-CN/search.md b/docs/markdown/zh-CN/search.md
similarity index 76%
rename from docs/examples-docs/zh-CN/search.md
rename to docs/markdown/zh-CN/search.md
index a4c62a82b..baf4e5c65 100644
--- a/docs/examples-docs/zh-CN/search.md
+++ b/docs/markdown/zh-CN/search.md
@@ -1,32 +1,3 @@
-
-
-
-
## Search 搜索
### 使用指南
@@ -41,44 +12,38 @@ Vue.component(Search.name, Search);
#### 基础用法
`van-search` 中,v-model 用于控制搜索框中的文字。background 可以自定义搜索框外部背景色。
-:::demo 基础用法
```html
-
+
```
-:::
#### 监听对应事件
`van-search` 提供了 search 和 cancel 事件。search 事件在用户点击键盘上的 搜索/回车 按钮触发。cancel 事件在用户点击搜索框右侧取消按钮时触发
Tips: 在 `van-search` 外层增加 form 标签,并且 action 不为空,即可在 IOS 弹出的输入法中显示搜索按钮
-:::demo 监听对应事件
```html
```
-:::
#### 自定义行动按钮
`van-search` 支持自定义右侧取消按钮,使用名字为 action 的 slot 即可。使用此 slot 以后,原有的 cancel 事件不再生效。
-:::demo 自定义行动按钮
```html
搜索
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/sku.md b/docs/markdown/zh-CN/sku.md
similarity index 65%
rename from docs/examples-docs/zh-CN/sku.md
rename to docs/markdown/zh-CN/sku.md
index 80d642f94..022101b94 100644
--- a/docs/examples-docs/zh-CN/sku.md
+++ b/docs/markdown/zh-CN/sku.md
@@ -1,50 +1,5 @@
## Sku 商品购买组件
-
-
-
-
### 使用指南
```javascript
import { Sku } from 'vant';
@@ -54,70 +9,58 @@ Vue.component(Sku.name, Sku);
### 代码演示
#### 基础用法
-:::demo
-```html
-
-
-
-
-
基础用法
-
-
-```
-:::
-#### 自定义sku slot区块
-:::demo
```html
-
-
-
-
-
-
-
-
-
- 积分兑换
-
-
-
- 买买买
-
-
-
-
-
自定义sku actions
-
-
+
```
-:::
+
+#### 自定义 sku slot 区块
+
+```html
+
+
+
+
+
+
+
+ 积分兑换
+
+
+
+ 买买买
+
+
+
+
+```
+
### API
diff --git a/docs/examples-docs/zh-CN/stepper.md b/docs/markdown/zh-CN/stepper.md
similarity index 74%
rename from docs/examples-docs/zh-CN/stepper.md
rename to docs/markdown/zh-CN/stepper.md
index fe24b38b2..8034518f7 100644
--- a/docs/examples-docs/zh-CN/stepper.md
+++ b/docs/markdown/zh-CN/stepper.md
@@ -1,22 +1,3 @@
-
-
-
-
## Stepper 步进器
### 使用指南
@@ -30,9 +11,8 @@ Vue.component(Stepper.name, Stepper);
#### 基础用法
-:::demo 基础用法
```html
-
+
```
```javascript
@@ -44,26 +24,21 @@ export default {
}
}
```
-:::
#### 禁用状态
通过设置`disabled`属性来禁用 stepper
-:::demo 禁用状态
```html
-
+
```
-:::
#### 高级用法
默认是每次加减为1,可以对组件设置`step`、`min`、`max`、`defaultValue`属性
-:::demo 高级用法
```html
-
+
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/steps.md b/docs/markdown/zh-CN/steps.md
similarity index 60%
rename from docs/examples-docs/zh-CN/steps.md
rename to docs/markdown/zh-CN/steps.md
index 7a9f64120..1c2f0608d 100644
--- a/docs/examples-docs/zh-CN/steps.md
+++ b/docs/markdown/zh-CN/steps.md
@@ -1,43 +1,3 @@
-
-
-
-
## Steps 步骤条
### 使用指南
@@ -52,7 +12,6 @@ Vue.component(Steps.name, Steps);
#### 基础用法
-:::demo 基础用法
```html
买家下单
@@ -60,8 +19,6 @@ Vue.component(Steps.name, Steps);
买家提货
交易完成
-
-
下一步
```
```javascript
@@ -70,29 +27,20 @@ export default {
return {
active: 0
};
- },
-
- methods: {
- nextStep() {
- this.active = ++this.active % 4;
- }
}
}
```
-:::
#### 物流描述
通过`title`和`description`属性来定义物流描述信息
-:::demo 物流描述
```html
买家下单
商家接单
@@ -100,15 +48,12 @@ export default {
交易完成
```
-:::
#### 竖向步骤条
-
可以通过设置`direction`属性来改变步骤条的显示方式
-:::demo 竖向步骤条
```html
-
+
【城市】物流状态1
2016-07-12 12:40
@@ -123,23 +68,6 @@ export default {
```
-:::
-
-### 高级用法
-使用`slot`增加自定义内容
-
-:::demo 高级用法
-```html
-
-
- 物流进度
- 买家下单
- 商家接单
- 买家提货
- 交易完成
-
-```
-:::
### Steps API
diff --git a/docs/examples-docs/zh-CN/submit-bar.md b/docs/markdown/zh-CN/submit-bar.md
similarity index 62%
rename from docs/examples-docs/zh-CN/submit-bar.md
rename to docs/markdown/zh-CN/submit-bar.md
index 6d0617f22..944ec64c5 100644
--- a/docs/examples-docs/zh-CN/submit-bar.md
+++ b/docs/markdown/zh-CN/submit-bar.md
@@ -1,31 +1,5 @@
## SubmitBar 提交订单栏
-
-
-
-
### 使用指南
``` javascript
import { SubmitBar } from 'vant';
@@ -37,67 +11,61 @@ Vue.component(SubmitBar.name, SubmitBar);
#### 基础用法
-:::demo 基础用法
```html
```
-:::
#### 禁用状态
禁用状态下不会触发`submit`事件
-:::demo 禁用状态
```html
```
-:::
#### 加载状态
加载状态下不会触发`submit`事件
-:::demo 加载状态
+
```html
```
-:::
-####
+#### 高级用法
提示文案中的额外操作和说明
-:::demo 提示文案中添加操作
+
```html
- 您的收货地址不支持同城送, 修改地址 >
+ 您的收货地址不支持同城送, 修改地址 >
```
-:::
### API
| 参数 | 说明 | 类型 | 默认值 | 必须 |
|-----------|-----------|-----------|-------------|-------------|
| price | 价格(单位分) | `Number` | - | 是 |
-| button-text | 按钮文字 | `String` | - | 是 |
-| button-type | 按钮类型 | `String` | `danger` | 否 |
+| buttonText | 按钮文字 | `String` | - | 是 |
+| buttonType | 按钮类型 | `String` | `danger` | 否 |
| tip | 提示文案 | `String` | - | 否 |
| disabled | 是否禁用按钮 | `Boolean` | `false` | 否 |
| loading | 是否显示加载中的按钮 | `Boolean` | `false` | 否 |
diff --git a/docs/examples-docs/zh-CN/swipe.md b/docs/markdown/zh-CN/swipe.md
similarity index 57%
rename from docs/examples-docs/zh-CN/swipe.md
rename to docs/markdown/zh-CN/swipe.md
index 5470707b8..eb7d48083 100644
--- a/docs/examples-docs/zh-CN/swipe.md
+++ b/docs/markdown/zh-CN/swipe.md
@@ -1,54 +1,3 @@
-
-
-
-
## Swipe 轮播
### 使用指南
@@ -64,7 +13,6 @@ Vue.component(SwipeItem.name, SwipeItem);
#### 基础用法
通过`autoplay`属性设置自动轮播间隔
-:::demo 基础用法
```html
1
@@ -73,12 +21,10 @@ Vue.component(SwipeItem.name, SwipeItem);
4
```
-:::
#### 图片懒加载
配合 [Lazyload](#/zh-CN/component/lazyload) 组件实现图片懒加载
-:::demo 图片懒加载
```html
@@ -99,7 +45,6 @@ export default {
}
}
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/switch-cell.md b/docs/markdown/zh-CN/switch-cell.md
similarity index 79%
rename from docs/examples-docs/zh-CN/switch-cell.md
rename to docs/markdown/zh-CN/switch-cell.md
index 3474e56c7..5064153e7 100644
--- a/docs/examples-docs/zh-CN/switch-cell.md
+++ b/docs/markdown/zh-CN/switch-cell.md
@@ -2,16 +2,6 @@
`SwitchCell`组件是对`Switch`和`Cell`组件的封装
-
-
### 使用指南
``` javascript
import { SwitchCell } from 'vant';
@@ -23,7 +13,7 @@ Vue.component(SwitchCell.name, SwitchCell);
#### 基础用法
-:::demo 基础用法
+
```html
@@ -39,29 +29,24 @@ export default {
}
}
```
-:::
#### 禁用状态
通过`disabled`属性可以将组件设置为禁用状态
-:::demo 禁用状态
```html
-
+
```
-:::
#### 加载状态
通过`loading`属性可以将组件设置为加载状态
-:::demo 加载状态
```html
-
+
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/switch.md b/docs/markdown/zh-CN/switch.md
similarity index 64%
rename from docs/examples-docs/zh-CN/switch.md
rename to docs/markdown/zh-CN/switch.md
index 5511d5d68..3d439c328 100644
--- a/docs/examples-docs/zh-CN/switch.md
+++ b/docs/markdown/zh-CN/switch.md
@@ -1,35 +1,3 @@
-
-
-
-
## Switch 开关
### 使用指南
@@ -42,8 +10,6 @@ Vue.component(Switch.name, Switch);
### 代码演示
#### 基础用法
-
-:::demo 基础用法
```html
```
@@ -57,32 +23,27 @@ export default {
}
};
```
-:::
#### 禁用状态
-:::demo 禁用状态
```html
```
-:::
#### 加载状态
-:::demo 加载状态
```html
```
-:::
#### 高级用法
-:::demo 高级用法
```html
-
+
```
+
```js
export default {
data() {
return {
- checked2: true
+ checked: true
};
},
@@ -92,13 +53,12 @@ export default {
title: '提醒',
message: '是否切换开关?'
}).then(() => {
- this.checked2 = checked;
+ this.checked = checked;
});
}
}
};
```
-:::
### API
diff --git a/docs/markdown/zh-CN/tab.md b/docs/markdown/zh-CN/tab.md
new file mode 100644
index 000000000..5e750a0d3
--- /dev/null
+++ b/docs/markdown/zh-CN/tab.md
@@ -0,0 +1,129 @@
+
+
+## Tabs 标签页
+
+### 使用指南
+``` javascript
+import { Tab, Tabs } from 'vant';
+
+Vue.component(Tab.name, Tab);
+Vue.component(Tabs.name, Tabs);
+```
+
+### 代码演示
+
+#### 基础用法
+
+默认情况下启用第一个 tab,可以通过`active`属性激活对应特定索引的 tab
+
+```html
+
+
+ 内容 {{ index }}
+
+
+```
+
+```js
+export default {
+ data() {
+ return {
+ active: 2
+ };
+ }
+}
+```
+
+#### 横向滚动
+
+默认情况下多于4个tab时,可以横向滚动tab。可以通过设置`swipeThreshold`这个阙值,多于这个阙值时,tab就会支持横向滚动。
+
+```html
+
+
+ 内容 {{ index }}
+
+
+```
+
+#### 禁用标签
+
+在对应的`van-tab`上设置`disabled`属性即可。如果需要监听禁用事件,可以在`van-tabs`上监听`disabled`事件。
+
+```html
+
+
+ 内容 {{ index }}
+
+
+```
+
+```javascript
+export default {
+ methods: {
+ onClickDisabled() {
+ Toast('Disabled!')
+ }
+ }
+};
+```
+
+#### 样式风格
+
+`Tabs`目前有两种样式:`line`和`card`,默认为`line`样式,也就上面基础用法中的样式,你可以在`van-tabs`上设置`type`为`card`改为card样式。
+
+```html
+
+
+ 内容 {{ index }}
+
+
+```
+
+#### 点击事件
+
+可以在`van-tabs`上绑定一个`click`事件,事件处理函数有一个参数,参数为对应`tab`在`tabs`中的索引。
+
+```html
+
+
+ 内容 {{ index }}
+
+
+```
+
+```javascript
+export default {
+ methods: {
+ handleTabClick(index) {
+ Toast(index);
+ }
+ }
+};
+```
+
+### Tabs API
+
+| 参数 | 说明 | 类型 | 默认值 | 可选 |
+|-----------|-----------|-----------|-------------|-------------|
+| type | Tab 样式类型 | `String` | `line` | `card` |
+| active | 默认激活的 tab | `String` `Number` | `0` | - |
+| duration | 切换 tab 的动画时间 | `Number` | `0.3` | - | - |
+| swipeThreshold | 滚动阀值,设置 Tab 超过多少个可滚动 | `Number` | `4` | - | - |
+
+### Tab API
+
+| 参数 | 说明 | 类型 | 默认值 | 可选 |
+|-----------|-----------|-----------|-------------|-------------|
+| title | tab的标题 | `String` | - | - |
+| disabled | 是否禁用这个tab | `Boolean` | `false` | - |
+
+### Tabs Event
+
+| 事件名 | 说明 | 参数 |
+|-----------|-----------|-----------|
+| click | 某个tab点击事件 | index:点击的`tab`的索引 |
+| disabled | 某个tab禁用时点击事件 | index:点击的`tab`的索引 |
+
diff --git a/docs/examples-docs/zh-CN/tabbar.md b/docs/markdown/zh-CN/tabbar.md
similarity index 76%
rename from docs/examples-docs/zh-CN/tabbar.md
rename to docs/markdown/zh-CN/tabbar.md
index 0a680de40..e32c9779e 100644
--- a/docs/examples-docs/zh-CN/tabbar.md
+++ b/docs/markdown/zh-CN/tabbar.md
@@ -1,32 +1,5 @@
## Tabbar 标签栏
-
-
-
-
### 使用指南
``` javascript
import { Tabbar, TabbarItem } from 'vant';
@@ -39,7 +12,7 @@ Vue.component(TabbarItem.name, TabbarItem);
#### 基础用法
-:::demo 基础用法
+
```html
标签
@@ -58,17 +31,17 @@ export default {
}
}
```
-:::
+
#### 自定义图标
通过 icon slot 自定义图标
-:::demo 自定义图标
+
```html
-
+
自定义
-
+
标签
标签
@@ -79,7 +52,7 @@ export default {
export default {
data() {
return {
- active2: 0,
+ active: 0,
icon: {
normal: '//img.yzcdn.cn/1.png',
active: '//img.yzcdn.cn/2.png'
@@ -88,7 +61,7 @@ export default {
}
}
```
-:::
+
### Tabbar API
diff --git a/docs/examples-docs/zh-CN/tag.md b/docs/markdown/zh-CN/tag.md
similarity index 84%
rename from docs/examples-docs/zh-CN/tag.md
rename to docs/markdown/zh-CN/tag.md
index 11c3479e5..7aa9b06b2 100644
--- a/docs/examples-docs/zh-CN/tag.md
+++ b/docs/markdown/zh-CN/tag.md
@@ -1,17 +1,3 @@
-
-
## Tag 标记
### 使用指南
@@ -25,38 +11,33 @@ Vue.component(Tag.name, Tag);
#### 基础用法
通过 type 属性控制 Tag 颜色,默认为灰色
-:::demo 基础用法
+
```html
标签
标签
标签
标签
```
-:::
#### 空心样式
设置`plain`属性设置为空心样式
-:::demo 空心样式
```html
标签
标签
标签
标签
```
-:::
#### 标记样式
通过`mark`设置为标记样式
-:::demo 标记样式
```html
标签
标签
标签
标签
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/theme.md b/docs/markdown/zh-CN/theme.md
similarity index 100%
rename from docs/examples-docs/zh-CN/theme.md
rename to docs/markdown/zh-CN/theme.md
diff --git a/docs/markdown/zh-CN/toast.md b/docs/markdown/zh-CN/toast.md
new file mode 100644
index 000000000..4ec09d493
--- /dev/null
+++ b/docs/markdown/zh-CN/toast.md
@@ -0,0 +1,74 @@
+## Toast 轻提示
+
+### 使用指南
+
+```javascript
+import { Toast } from 'vant';
+```
+
+### 代码演示
+
+#### 文字提示
+
+```javascript
+Toast('我是提示文案,建议不超过十五字~');
+```
+
+
+#### 加载提示
+
+```javascript
+Toast.loading({ mask: true });
+```
+
+
+#### 成功/失败提示
+
+```javascript
+Toast.success('成功文案');
+Toast.fail('失败文案');
+```
+
+
+#### 高级用法
+
+```javascript
+const toast = Toast.loading({
+ duration: 0, // 持续展示 toast
+ forbidClick: true, // 禁用背景点击
+ message: '倒计时 3 秒'
+});
+
+let second = 3;
+const timer = setInterval(() => {
+ second--;
+ if (second) {
+ toast.message = `倒计时 ${second} 秒`;
+ } else {
+ clearInterval(timer);
+ Toast.clear();
+ }
+}, 1000);
+```
+
+
+### 方法
+
+| 方法名 | 参数 | 返回值 | 介绍 |
+|-----------|-----------|-----------|-------------|
+| Toast | `options | message` | toast 实例 | 展示提示 |
+| Toast.loading | `options | message` | toast 实例 | 展示加载提示 |
+| Toast.success | `options | message` | toast 实例 | 展示成功提示 |
+| Toast.fail | `options | message` | toast 实例 | 展示失败提示 |
+| Toast.clear | - | `void` | 关闭提示 |
+
+### Options
+
+| 参数 | 说明 | 类型 | 默认值 | 可选值 |
+|-----------|-----------|-----------|-------------|-------------|
+| type | 提示类型 | `String` | `text` | `loading` `success` `fail` `html` |
+| message | 内容 | `String` | `''` | - |
+| position | 位置 | `String` | `middle` | `top` `bottom` |
+| mask | 是否显示背景蒙层 | `Boolean` | `false` | - |
+| forbidClick | 禁止背景点击 | `Boolean` | `false` | - |
+| duration | 时长(ms) | `Number` | `3000` | 值为 0 时,toast 不会消失 |
diff --git a/docs/examples-docs/zh-CN/tree-select.md b/docs/markdown/zh-CN/tree-select.md
similarity index 55%
rename from docs/examples-docs/zh-CN/tree-select.md
rename to docs/markdown/zh-CN/tree-select.md
index 3fe95add7..e74806120 100644
--- a/docs/examples-docs/zh-CN/tree-select.md
+++ b/docs/markdown/zh-CN/tree-select.md
@@ -1,79 +1,3 @@
-
-
## TreeSelect 分类选择
### 使用指南
@@ -87,7 +11,7 @@ Vue.component(TreeSelect.name, TreeSelect);
#### 基础用法
-:::demo 基础用法
+
```html
+/>
```
```javascript
@@ -114,13 +38,11 @@ export default {
this.mainActiveIndex = index;
},
onItemClick(data) {
- console.log(data);
this.activeId = data.id;
}
}
}
```
-:::
### API
@@ -128,9 +50,9 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | 必须 |
|-----------|-----------|-----------|-------------|-------------|
-| items | 分类显示所需的数据,具体数据结构可看 数据结构 | Array | [] | - |
-| mainActiveIndex | 左侧导航高亮的索引 | Number | 0 | - |
-| activeId | 右侧选择项,高亮的数据id | Number | 0 | - |
+| items | 分类显示所需的数据,具体数据结构可看 数据结构 | `Array` | `[]` | - |
+| mainActiveIndex | 左侧导航高亮的索引 | `Number` | `0` | - |
+| activeId | 右侧选择项,高亮的数据id | `Number` | `0` | - |
#### 事件
| 事件名 | 说明 | 参数 |
diff --git a/docs/examples-docs/zh-CN/uploader.md b/docs/markdown/zh-CN/uploader.md
similarity index 74%
rename from docs/examples-docs/zh-CN/uploader.md
rename to docs/markdown/zh-CN/uploader.md
index 6dfb415cc..a90dd6833 100644
--- a/docs/examples-docs/zh-CN/uploader.md
+++ b/docs/markdown/zh-CN/uploader.md
@@ -1,19 +1,3 @@
-
-
-
-
## Uploader 图片上传
### 使用指南
@@ -27,13 +11,10 @@ Vue.component(Uploader.name, Uploader);
#### 基础用法
-:::demo 基础用法
```html
-
-
-
-
-
+
+
+
```
```javascript
@@ -43,9 +24,8 @@ export default {
console.log(file)
}
}
-};
+};
```
-:::
### API
diff --git a/docs/examples-docs/zh-CN/waterfall.md b/docs/markdown/zh-CN/waterfall.md
similarity index 67%
rename from docs/examples-docs/zh-CN/waterfall.md
rename to docs/markdown/zh-CN/waterfall.md
index 46aa7ec15..ab48739e7 100644
--- a/docs/examples-docs/zh-CN/waterfall.md
+++ b/docs/markdown/zh-CN/waterfall.md
@@ -28,65 +28,12 @@ export default {
### 代码演示
-
-
-
-
#### 基础用法
使用 `v-waterfall-lower` 监听滚动到达底部,并执行相应函数。若是函数执行中需要异步加载数据,可以将 `waterfall-disabled` 指定的值置为 true,禁止 `v-waterfall-lower` 监听滚动事件
注意:`waterfall-disabled` 传入的是 vue 对象中表示是否禁止瀑布流触发 key 值,类型是字符串
-:::demo 基础用法
+
```html
-当即将滚动到元素底部时,会自动加载更多
-
+
-
+
-
-
diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js
index 6232a9cce..f32d349d5 100644
--- a/docs/src/doc.config.js
+++ b/docs/src/doc.config.js
@@ -305,6 +305,17 @@ module.exports = {
path: '/changelog',
title: 'Changelog',
noExample: true
+ },
+ {
+ path: '/theme',
+ title: 'Theme (In translation)',
+ noExample: true
+ },
+ {
+ path: '/demo',
+ title: 'Demo pages (In translation)',
+ noDocument: true,
+ noExample: true
}
]
}
@@ -491,35 +502,35 @@ module.exports = {
list: [
{
path: '/address-edit',
- title: 'AddressEdit'
+ title: 'AddressEdit (In translation)'
},
{
path: '/address-list',
- title: 'AddressList'
+ title: 'AddressList (In translation)'
},
{
path: '/area',
- title: 'Area'
+ title: 'Area (In translation)'
},
{
path: '/contact',
- title: 'Contact'
+ title: 'Contact (In translation)'
},
{
path: '/coupon',
- title: 'Coupon'
+ title: 'Coupon (In translation)'
},
{
path: '/goods-action',
- title: 'GoodsAction'
+ title: 'GoodsAction (In translation)'
},
{
path: '/submit-bar',
- title: 'SubmitBar'
+ title: 'SubmitBar (In translation)'
},
{
path: '/sku',
- title: 'Sku'
+ title: 'Sku (In translation)'
}
]
}
diff --git a/docs/src/examples.js b/docs/src/examples.js
index 7bf0af320..398b80127 100644
--- a/docs/src/examples.js
+++ b/docs/src/examples.js
@@ -2,14 +2,13 @@ import Vue from 'vue';
import VueRouter from 'vue-router';
import App from './WapApp';
import routes from './router.config';
-import { setLang } from './utils/lang';
import Vant, { Lazyload } from 'packages';
-import ZanDoc from 'zan-doc';
+import VantDoc from 'vant-doc';
import 'packages/vant-css/src/index.css';
-import 'zan-doc/src/helper/touch-simulator';
+import 'vant-doc/src/helper/touch-simulator';
Vue.use(Vant);
-Vue.use(ZanDoc);
+Vue.use(VantDoc);
Vue.use(Lazyload, {
lazyComponent: true
});
@@ -22,14 +21,6 @@ const router = new VueRouter({
routes: routesConfig
});
-router.afterEach((route) => {
- const container = document.querySelector('.examples-container');
- if (container) {
- document.querySelector('.examples-container').scrollTop = 0;
- }
- setLang(route.meta.lang);
-});
-
window.vueRouter = router;
if (process.env.NODE_ENV !== 'production') {
diff --git a/docs/src/index.js b/docs/src/index.js
index 740e18663..7d37b5187 100644
--- a/docs/src/index.js
+++ b/docs/src/index.js
@@ -2,11 +2,11 @@ import Vue from 'vue';
import VueRouter from 'vue-router';
import App from './DocsApp';
import routes from './router.config';
-import ZanDoc from 'zan-doc';
+import VantDoc from 'vant-doc';
import isMobile from './utils/is-mobile';
Vue.use(VueRouter);
-Vue.use(ZanDoc);
+Vue.use(VantDoc);
const routesConfig = routes();
diff --git a/docs/src/router.config.js b/docs/src/router.config.js
index 9f681de18..c9b409fe6 100644
--- a/docs/src/router.config.js
+++ b/docs/src/router.config.js
@@ -1,18 +1,15 @@
import docConfig from './doc.config';
-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 componentDocs from '../markdown';
+import componentDemos from '../demos';
+import { Demos } from 'vant-doc';
+import Vue from 'vue';
import './utils/iframe-router';
const registerRoute = (isExample) => {
const route = [{
- path: '/',
- redirect: to => `/${getLang()}/`
- }, {
path: '*',
- redirect: to => `/${getLang()}/`
+ redirect: to => `/${Vue.prototype.$vantLang}/`
}];
Object.keys(docConfig).forEach((lang, index) => {
@@ -53,9 +50,9 @@ const registerRoute = (isExample) => {
let component;
if (path === '/demo') {
- component = Demo;
+ component = Demos;
} else {
- component = isExample ? componentDemos[name] : componentDocs[name];
+ component = isExample ? componentDemos[path.replace('/', '')] : componentDocs[name];
}
route.push({
diff --git a/docs/src/utils/iframe-router.js b/docs/src/utils/iframe-router.js
index f23769b73..458045e2e 100644
--- a/docs/src/utils/iframe-router.js
+++ b/docs/src/utils/iframe-router.js
@@ -13,19 +13,20 @@ window.syncPath = function(dir) {
const iframe = document.querySelector('iframe');
if (!isInIframe && !isMobile && iframe) {
+ const pathParts = currentDir.split('/');
+ let lang = pathParts[0];
+ if (currentDir[0] === '/') {
+ lang = pathParts[1];
+ }
+ setLang(lang);
+
iframeReady(iframe, () => {
- iframe.contentWindow.changePath(currentDir);
+ iframe.contentWindow.changePath(lang, currentDir);
});
}
};
-window.changePath = function(path = '') {
- const pathParts = path.split('/');
- let lang = pathParts[0];
- if (path[0] === '/') {
- lang = pathParts[1];
- }
-
+window.changePath = function(lang, path = '') {
setLang(lang);
window.vueRouter.replace(path);
};
diff --git a/docs/src/utils/lang.js b/docs/src/utils/lang.js
index 1a291fd84..0f117b40b 100644
--- a/docs/src/utils/lang.js
+++ b/docs/src/utils/lang.js
@@ -1,16 +1,20 @@
+import Locale from '../../../packages/locale';
+import zhCN from '../../../packages/locale/lang/zh-CN';
+import enUS from '../../../packages/locale/lang/en-US';
+
+const langMap = {
+ 'en-US': enUS,
+ 'zh-CN': zhCN
+};
+
const userLang = window.localStorage.getItem('VANT_LANGUAGE') || window.navigator.language || 'en-US';
let defaultLang = 'en-US';
if (userLang.indexOf('zh-') !== -1) {
defaultLang = 'zh-CN';
}
-
-let currentLang = defaultLang;
-
-export function getLang() {
- return currentLang;
-}
+setLang(defaultLang);
export function setLang(lang) {
window.localStorage.setItem('VANT_LANGUAGE', lang);
- currentLang = lang;
+ Locale.use(lang, langMap[lang]);
}
diff --git a/package.json b/package.json
index 994ed77e9..6bf9b3a5f 100644
--- a/package.json
+++ b/package.json
@@ -81,7 +81,6 @@
"highlight.js": "^9.12.0",
"html-webpack-plugin": "^2.29.0",
"isparta-loader": "^2.0.0",
- "json-templater": "^1.0.4",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
@@ -90,7 +89,7 @@
"karma-sinon-chai": "^1.3.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.31",
- "karma-webpack": "^2.0.4",
+ "karma-webpack": "^2.0.6",
"markdown-it": "^8.4.0",
"markdown-it-container": "^2.0.0",
"mocha": "^3.4.2",
@@ -107,6 +106,7 @@
"style-loader": "^0.19.0",
"uppercamelcase": "^3.0.0",
"url-loader": "^0.6.2",
+ "vant-doc": "0.3.16",
"vue": "^2.5.3",
"vue-loader": "^13.5.0",
"vue-markdown-loader": "^2.2.3",
@@ -115,9 +115,8 @@
"vue-style-loader": "^3.0.0",
"vue-template-compiler": "^2.5.3",
"webpack": "^3.8.1",
- "webpack-bundle-analyzer": "^2.9.0",
+ "webpack-bundle-analyzer": "^2.9.1",
"webpack-dev-server": "^2.9.4",
- "webpack-merge": "^4.1.1",
- "zan-doc": "0.3.11"
+ "webpack-merge": "^4.1.1"
}
}
diff --git a/packages/address-edit/Detail.vue b/packages/address-edit/Detail.vue
index c025f4ffe..5f9bbb4cd 100644
--- a/packages/address-edit/Detail.vue
+++ b/packages/address-edit/Detail.vue
@@ -1,8 +1,8 @@
- 完成
+ {{ $t('complete') }}
@@ -42,10 +42,13 @@ import Field from '../field';
import Cell from '../cell';
import CellGroup from '../cell-group';
import isAndroid from '../utils/env/is-android';
+import { i18n } from '../locale';
export default {
name: 'van-address-edit-detail',
+ mixins: [i18n],
+
components: {
[Field.name]: Field,
[Icon.name]: Icon,
@@ -85,7 +88,7 @@ export default {
},
handleBlur(e) {
- // 等待其他地方点击事件完了以后,再触发
+ // wait for click event finished
setTimeout(() => {
this.isFocused = false;
this.$emit('blur', e);
diff --git a/packages/address-edit/index.vue b/packages/address-edit/index.vue
index 8af8ec1ca..6b2aeeef9 100644
--- a/packages/address-edit/index.vue
+++ b/packages/address-edit/index.vue
@@ -3,24 +3,24 @@
-
- {{ currentInfo.province || '选择省' }}
- {{ currentInfo.city || '选择市' }}
- {{ currentInfo.county || '选择区' }}
+
+ {{ currentInfo.province || $t('placeholder.province') }}
+ {{ currentInfo.city || $t('placeholder.city') }}
+ {{ currentInfo.county || $t('placeholder.county') }}
- 保存
- 删除{{ addressText }}地址
+
+ {{ $t('save') }}
+
+
+ {{ $t('deleteAddress', computedAddressText) }}
+
({
@@ -145,13 +149,16 @@ export default {
this.isEdit = !!val.id;
},
deep: true
- }
+ },
},
computed: {
- // 当地址输入框开启了搜索,并且开始搜索后,隐藏所有地址详情以外的输入框
+ // hide bottom field when use search && detail get focused
hideBottomFields() {
return this.searchResult.length && this.detailFocused;
+ },
+ computedAddressText() {
+ return this.addressText || this.$t('addressText');
}
},
@@ -172,13 +179,13 @@ export default {
onAreaConfirm(values) {
if (values.length !== 3 || +values[0].code === -1 || +values[1].code === -1 || +values[2].code === -1) {
- return Toast('请选择正确的收件地区');
+ return Toast(this.$t('areaWrong'));
}
Object.assign(this.currentInfo, {
province: values[0].name,
city: values[1].name,
county: values[2].name,
- 'area_code': values[2].code
+ area_code: values[2].code
});
this.showAreaSelect = false;
},
@@ -211,18 +218,19 @@ export default {
getErrorMessageByKey(key) {
const value = this.currentInfo[key];
+ const { $t } = this;
switch (key) {
case 'name':
- return value ? value.length <= 15 ? '' : '名字过长,请重新输入' : '请填写名字';
+ return value ? value.length <= 15 ? '' : $t('nameOverlimit') : $t('nameEmpty');
case 'tel':
- return validateMobile(value) ? '' : '请填写正确的手机号码或电话号码';
+ return validateMobile(value) ? '' : $t('telWrong');
case 'area_code':
- return value ? +value !== -1 ? '' : '请选择正确的收件地区' : '请选择收件地区';
+ return value ? +value !== -1 ? '' : $t('areaWrong') : $t('areaEmpty');
case 'address_detail':
- return value ? value.length <= 200 ? '' : '详细地址不能超过200个字符' : '请填写详细地址';
+ return value ? value.length <= 200 ? '' : $t('addressOverlimit') : $t('addressEmpty');
case 'postal_code':
- return value && !/^\d{6}$/.test(value) ? '邮政编码格式不正确' : '';
+ return value && !/^\d{6}$/.test(value) ? $t('postalEmpty') : '';
}
},
@@ -232,7 +240,7 @@ export default {
}
Dialog.confirm({
- message: `确定要删除这个${this.addressText}地址么`
+ message: this.$t('confirmDelete', this.computedAddressText)
}).then(() => {
this.$emit('delete', this.currentInfo);
});
diff --git a/packages/address-edit/theme.md b/packages/address-edit/theme.md
new file mode 100644
index 000000000..73cfeec5a
--- /dev/null
+++ b/packages/address-edit/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/packages/area/index.vue b/packages/area/index.vue
index 33efd6138..a58731af3 100644
--- a/packages/area/index.vue
+++ b/packages/area/index.vue
@@ -36,9 +36,7 @@ export default {
props: {
value: {},
areaList: Object,
- /**
- * 省市县显示列数,3-省市县,2-省市,1-省
- */
+ // 省市县显示列数,3-省市县,2-省市,1-省
columnsNum: {
type: [String, Number],
default: 3
diff --git a/packages/badge-group/index.vue b/packages/badge-group/index.vue
index e2991a11f..72babb9cb 100644
--- a/packages/badge-group/index.vue
+++ b/packages/badge-group/index.vue
@@ -9,7 +9,6 @@ export default {
name: 'van-badge-group',
props: {
- // 当前激活 tab 面板的 key
activeKey: {
type: [Number, String],
default: 0
diff --git a/packages/cell-swipe/index.vue b/packages/cell-swipe/index.vue
index 7ab4ce705..3555c55f6 100644
--- a/packages/cell-swipe/index.vue
+++ b/packages/cell-swipe/index.vue
@@ -57,8 +57,8 @@ export default {
methods: {
resetSwipeStatus() {
- this.swiping = false; // 是否正在拖动
- this.opened = true; // 记录是否滑动左右 或者 注册
+ this.swiping = false;
+ this.opened = true;
},
swipeMove(offset = 0) {
diff --git a/packages/checkbox/index.vue b/packages/checkbox/index.vue
index 7f7e30cbe..afa02367d 100644
--- a/packages/checkbox/index.vue
+++ b/packages/checkbox/index.vue
@@ -50,7 +50,7 @@ export default {
},
computed: {
- // checkbox 是否在 van-checkbox-group 中
+ // whether is in van-checkbox-group
isGroup() {
return !!this.findParentByComponentName('van-checkbox-group');
},
diff --git a/packages/contact-card/index.vue b/packages/contact-card/index.vue
index ffc61b455..aaa4bf573 100644
--- a/packages/contact-card/index.vue
+++ b/packages/contact-card/index.vue
@@ -3,13 +3,13 @@
- {{ addText }}
+ {{ addText || $t('addText') }}
-
联系人:{{ name }}
-
联系电话:{{ tel }}
+
{{ $t('name') }}:{{ name }}
+
{{ $t('tel') }}:{{ tel }}
@@ -19,15 +19,19 @@