diff --git a/docs/examples-docs/zh-CN/search.md b/docs/examples-docs/zh-CN/search.md index ee2110fa1..a8d4bb55a 100644 --- a/docs/examples-docs/zh-CN/search.md +++ b/docs/examples-docs/zh-CN/search.md @@ -41,7 +41,7 @@ Vue.component(Search.name, Search); :::demo 基础用法 ```html - + ``` ::: @@ -73,7 +73,7 @@ Tips: 在 `van-search` 外层增加 form 标签,并且 action 不为空,即 v-model="value" :show-action="true" @search="onSearch"> -
搜索
+
搜索
``` ::: diff --git a/docs/src/ExamplesDocsApp.vue b/docs/src/DocsApp.vue similarity index 63% rename from docs/src/ExamplesDocsApp.vue rename to docs/src/DocsApp.vue index c6572b4fc..b771c54f9 100644 --- a/docs/src/ExamplesDocsApp.vue +++ b/docs/src/DocsApp.vue @@ -1,7 +1,7 @@ @@ -17,10 +17,9 @@ export default { group.list = group.list.filter(item => item.title !== '业务组件'); } - const hash = window.location.hash; - return { - simulator: `/zanui/vue/examples${hash}`, + simulators: [`/zanui/vue/examples${location.hash}`], + demoURL: '', lang: getLang() }; }, @@ -32,6 +31,10 @@ export default { config() { return docConfig[this.lang]; + }, + + currentSimulator() { + return this.$route.name === 'zh-CN/demo' ? 1 : 0; } }, @@ -39,6 +42,12 @@ export default { '$route'(to) { this.lang = to.meta.lang; } + }, + + methods: { + onChangeDemoURL(url) { + this.simulators = [this.simulators[0], url]; + } } }; diff --git a/docs/src/ExamplesApp.vue b/docs/src/WapApp.vue similarity index 100% rename from docs/src/ExamplesApp.vue rename to docs/src/WapApp.vue diff --git a/docs/src/components/demo.vue b/docs/src/components/demo.vue new file mode 100644 index 000000000..46b120468 --- /dev/null +++ b/docs/src/components/demo.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index 4bb19a109..a5cf2fe79 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -28,12 +28,18 @@ module.exports = { }, { title: '业务组件', - link: '/zanui/captain/component/quickstart' + link: '/zanui/captain' }, { path: '/changelog', title: '更新日志', noExample: true + }, + { + path: '/demo', + title: '示例页面', + noDocument: true, + noExample: true } ] } diff --git a/docs/src/examples.js b/docs/src/examples.js index 3d8eef83b..60b8e7d06 100644 --- a/docs/src/examples.js +++ b/docs/src/examples.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; -import App from './ExamplesApp'; +import App from './WapApp'; import routes from './router.config'; import { setLang } from './utils/lang'; import Vant, { Lazyload } from 'packages'; diff --git a/docs/src/index.js b/docs/src/index.js index 0d2946522..8eea7e664 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; -import App from './ExamplesDocsApp'; +import App from './DocsApp'; import routes from './router.config'; import ZanDoc from 'zan-doc'; import isMobile from './utils/is-mobile'; diff --git a/docs/src/router.config.js b/docs/src/router.config.js index 257231f08..9f681de18 100644 --- a/docs/src/router.config.js +++ b/docs/src/router.config.js @@ -3,19 +3,16 @@ import { getLang } from './utils/lang'; import DemoList from './components/demo-list'; import componentDocs from '../examples-dist/entry-docs'; import componentDemos from '../examples-dist/entry-demos'; +import Demo from './components/demo'; import './utils/iframe-router'; const registerRoute = (isExample) => { const route = [{ path: '/', - redirect: to => { - return `/${getLang()}/`; - } + redirect: to => `/${getLang()}/` }, { path: '*', - redirect: to => { - return `/${getLang()}/`; - } + redirect: to => `/${getLang()}/` }]; Object.keys(docConfig).forEach((lang, index) => { @@ -53,9 +50,18 @@ const registerRoute = (isExample) => { const { path } = page; if (path) { const name = lang + '/' + path.replace('/', ''); + let component; + + if (path === '/demo') { + component = Demo; + } else { + component = isExample ? componentDemos[name] : componentDocs[name]; + } + route.push({ + name, + component, path: `/${lang}/component${path}`, - component: isExample ? componentDemos[name] : componentDocs[name], meta: { lang } }); } diff --git a/package.json b/package.json index e66744050..8036d513d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "vue": ">= 2.4.0" }, "devDependencies": { - "autoprefixer": "^7.1.3", + "autoprefixer": "^7.1.6", "avoriaz": "2.0.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", @@ -119,6 +119,6 @@ "webpack-bundle-analyzer": "^2.9.0", "webpack-dev-server": "^2.9.2", "webpack-merge": "^4.1.0", - "zan-doc": "^0.3.6" + "zan-doc": "^0.3.8" } } diff --git a/packages/cell/index.vue b/packages/cell/index.vue index 0f43adcef..bd090512d 100644 --- a/packages/cell/index.vue +++ b/packages/cell/index.vue @@ -1,15 +1,12 @@