From 28699034d5e83b8a62ab9c5bab5201138aad4d7f Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 2 Aug 2018 16:01:34 +0800 Subject: [PATCH] [Doc] update mobile nav (#1578) --- docs/src/components/DemoList.vue | 13 ++- docs/src/components/MobileNav.vue | 146 ++++++------------------------ docs/src/mobile.js | 12 +-- 3 files changed, 40 insertions(+), 131 deletions(-) diff --git a/docs/src/components/DemoList.vue b/docs/src/components/DemoList.vue index d493f10ca..c0bb3c819 100644 --- a/docs/src/components/DemoList.vue +++ b/docs/src/components/DemoList.vue @@ -9,11 +9,14 @@ 中文

{{ description }}

-
-
- -
-
+ diff --git a/docs/src/components/MobileNav.vue b/docs/src/components/MobileNav.vue index 4d697ddd5..bcbd2060a 100644 --- a/docs/src/components/MobileNav.vue +++ b/docs/src/components/MobileNav.vue @@ -1,145 +1,51 @@ diff --git a/docs/src/mobile.js b/docs/src/mobile.js index 166932aa2..55fd79f1d 100644 --- a/docs/src/mobile.js +++ b/docs/src/mobile.js @@ -1,15 +1,18 @@ +import '../../packages/vant-css/src/index.css'; +import './components/nprogress.css'; import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './WapApp'; import routes from './router'; import progress from 'nprogress'; -import '../../packages/vant-css/src/index.css'; import 'vant-doc/src/helper/touch-simulator'; -import './components/nprogress.css'; const router = new VueRouter({ mode: 'hash', - routes: routes(true) + routes: routes(true), + scrollBehavior(to, from, savedPosition) { + return savedPosition || { x: 0, y: 0 }; + } }); router.beforeEach((route, redirect, next) => { @@ -19,9 +22,6 @@ router.beforeEach((route, redirect, next) => { router.afterEach(() => { progress.done(); - if (router.currentRoute.name) { - window.scrollTo(0, 0); - } if (!router.currentRoute.redirectedFrom) { Vue.nextTick(() => window.syncPath()); }