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

View File

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

View File

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

View File

@ -18,8 +18,7 @@ window.syncPath = function(dir) {
};
window.changePath = function(path) {
const router = window.vueRouter;
router.replace(path);
window.vueRouter.replace(path);
};
function iframeReady(iframe, callback) {
@ -27,10 +26,15 @@ function iframeReady(iframe, callback) {
if (doc.readyState === 'complete') {
callback();
} else {
iframe.onload = () => {
setTimeout(() => {
const interval = () => {
if (iframe.contentWindow.changePath) {
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">
<title>ZanUI - 移动端</title>
</head>
<body>
<body ontouchstart>
<div id="app-container">
<app></app>

View File

@ -116,6 +116,6 @@
"webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1",
"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"
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"
zan-doc@^0.2.11:
version "0.2.11"
resolved "https://registry.npmjs.org/zan-doc/-/zan-doc-0.2.11.tgz#dab35d0c0fa10fc91a28129b6ca026f62e3da78d"
zan-doc@^0.2.12:
version "0.2.12"
resolved "https://registry.npmjs.org/zan-doc/-/zan-doc-0.2.12.tgz#bfbf9a7ec5a4b77a7f53ca1ac030b305432a91c5"
dependencies:
cheerio "0.22.0"
decamelize "^1.2.0"