Doc: optimzie mobile demo

This commit is contained in:
陈嘉涵 2017-09-05 10:17:49 +08:00
parent 5e84e2e9cb
commit 99f712104e
7 changed files with 21 additions and 26 deletions

View File

@ -10,8 +10,6 @@
</template> </template>
<script> <script>
import Vue from 'vue';
export default { export default {
computed: { computed: {
visible() { visible() {
@ -30,8 +28,8 @@ export default {
}, },
watch: { watch: {
'$route.path': function(val) { '$route.path'(val) {
Vue.nextTick(() => { this.$nextTick(() => {
this.computeFooterFixed(); this.computeFooterFixed();
}); });
} }

View File

@ -3,11 +3,9 @@
<h1 class="zanui-title">Zan UI Wap</h1> <h1 class="zanui-title">Zan UI Wap</h1>
<h2 class="zanui-desc">有赞移动wap端组件库</h2> <h2 class="zanui-desc">有赞移动wap端组件库</h2>
<div class="mobile-navs"> <div class="mobile-navs">
<template v-for="(item, index) in data"> <div class="mobile-nav-item" v-for="(item, index) in data" v-if="item.showInMobile" :key="index">
<div class="mobile-nav-item" v-if="item.showInMobile" :key="index"> <mobile-nav v-for="(group, index) in item.groups" :group="group" :base="base" :nav-key="index" :key="index" />
<mobile-nav v-for="(group, index) in item.groups" :group="group" :base="base" :nav-key="index" :key="index"></mobile-nav> </div>
</div>
</template>
</div> </div>
</div> </div>
</template> </template>
@ -19,8 +17,6 @@ import MobileNav from './mobile-nav';
export default { export default {
data() { data() {
return { return {
highlights: [],
navState: [],
data: docConfig['zh-CN'].nav, data: docConfig['zh-CN'].nav,
base: '/component' base: '/component'
}; };

View File

@ -25,15 +25,12 @@ const router = new VueRouter({
base: '/zanui/vue/examples', base: '/zanui/vue/examples',
routes: routesConfig routes: routesConfig
}); });
router.beforeEach((to, from, next) => {
router.afterEach(() => {
const container = document.querySelector('.examples-container'); const container = document.querySelector('.examples-container');
if (container) { if (container) {
document.querySelector('.examples-container').scrollTop = 0; document.querySelector('.examples-container').scrollTop = 0;
} }
next();
});
router.afterEach(() => {
window.syncPath(); window.syncPath();
}); });

View File

@ -18,8 +18,7 @@ window.syncPath = function(dir) {
}; };
window.changePath = function(path) { window.changePath = function(path) {
const router = window.vueRouter; window.vueRouter.replace(path);
router.replace(path);
}; };
function iframeReady(iframe, callback) { function iframeReady(iframe, callback) {
@ -27,10 +26,15 @@ function iframeReady(iframe, callback) {
if (doc.readyState === 'complete') { if (doc.readyState === 'complete') {
callback(); callback();
} else { } else {
iframe.onload = () => { const interval = () => {
setTimeout(() => { if (iframe.contentWindow.changePath) {
callback(); callback();
}, 50); } else {
setTimeout(() => {
interval();
}, 50);
}
}; };
iframe.onload = interval;
} }
} }

View File

@ -6,7 +6,7 @@
<link rel="shortcut icon" href="https://b.yzcdn.cn/zanui/icon/zanui.ico"> <link rel="shortcut icon" href="https://b.yzcdn.cn/zanui/icon/zanui.ico">
<title>ZanUI - 移动端</title> <title>ZanUI - 移动端</title>
</head> </head>
<body> <body ontouchstart>
<div id="app-container"> <div id="app-container">
<app></app> <app></app>

View File

@ -116,6 +116,6 @@
"webpack": "^3.5.5", "webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1", "webpack-dev-server": "^2.7.1",
"webpack-merge": "^4.1.0", "webpack-merge": "^4.1.0",
"zan-doc": "^0.2.11" "zan-doc": "^0.2.12"
} }
} }

View File

@ -7800,9 +7800,9 @@ yeast@0.1.2:
version "0.1.2" version "0.1.2"
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"
zan-doc@^0.2.11: zan-doc@^0.2.12:
version "0.2.11" version "0.2.12"
resolved "https://registry.npmjs.org/zan-doc/-/zan-doc-0.2.11.tgz#dab35d0c0fa10fc91a28129b6ca026f62e3da78d" resolved "https://registry.npmjs.org/zan-doc/-/zan-doc-0.2.12.tgz#bfbf9a7ec5a4b77a7f53ca1ac030b305432a91c5"
dependencies: dependencies:
cheerio "0.22.0" cheerio "0.22.0"
decamelize "^1.2.0" decamelize "^1.2.0"