mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
Doc: optimzie mobile demo
This commit is contained in:
parent
5e84e2e9cb
commit
99f712104e
@ -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();
|
||||
});
|
||||
}
|
||||
|
@ -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'
|
||||
};
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user