文档细节优化,search、咯阿丁和dialog组件样式修复 (#5)

* fix: loading small style, search style and dialog style

* fix: scroll to top

* fix mobile scroll

* fix scroll to top
This commit is contained in:
张敏
2017-04-23 22:38:50 +08:00
committed by GitHub
parent 1725eb6303
commit ce27957133
23 changed files with 95 additions and 60 deletions

View File

@@ -123,7 +123,8 @@ export default {
font-size: 14px;
font-weight: normal;
color: #999;
padding: 30px 15px 10px;
padding: 0 15px;
margin: 30px 0 10px;
}
.footer {

View File

@@ -5,7 +5,7 @@
<div class="mobile-navs">
<template v-for="item in data">
<div class="mobile-nav-item" v-if="item.showInMobile">
<mobile-nav v-for="group in item.groups" :group="group" :base="base"></mobile-nav>
<mobile-nav v-for="(group, index) in item.groups" :group="group" :base="base" :nav-key="index"></mobile-nav>
</div>
</template>
</div>

View File

@@ -7,11 +7,7 @@ export default {
computed: {
mobileUrl() {
if (process.env.NODE_ENV === 'production') {
return '/zanui/vue/examples#' + location.pathname.slice(10);
} else {
return '/examples.html#' + location.pathname;
}
return '/zanui/vue/examples' + location.pathname.slice(10);
}
},

View File

@@ -5,7 +5,7 @@
:class="{
'mobile-nav-group__title--open': isOpen
}"
@click="isOpen = !isOpen">
@click="handleNavTitleClick">
{{group.groupName}}
</div>
<div class="mobile-nav-group__list-wrapper" :class="{ 'mobile-nav-group__list-wrapper--open': isOpen }">
@@ -38,13 +38,25 @@ export default {
return [];
}
},
base: String
base: String,
navKey: [String, Number]
},
data() {
return {
isOpen: false
};
},
mounted() {
this.isOpen = JSON.parse(sessionStorage.getItem('mobile-nav-' + this.navKey));
},
methods: {
handleNavTitleClick() {
this.isOpen = !this.isOpen;
sessionStorage.setItem('mobile-nav-' + this.navKey, this.isOpen);
}
}
};
</script>

View File

@@ -15,24 +15,18 @@ Vue.use(ZanUI.Lazyload, {
});
Vue.use(VueRouter);
const isProduction = process.env.NODE_ENV === 'production';
const routesConfig = routes(navConfig, true);
routesConfig.push({
path: '/',
component: DemoList.default || DemoList
});
const router = new VueRouter({
mode: 'hash',
base: isProduction ? '/zanui/vue/' : __dirname,
mode: 'history',
base: '/zanui/vue/examples',
routes: routesConfig
});
router.beforeEach((route, redirect, next) => {
if (route.path !== '/') {
window.scrollTo(0, 0);
}
document.title = route.meta.title || document.title;
next();
router.afterEach((route, redirect, next) => {
document.querySelector('.examples-container').scrollTop = 0;
});
new Vue({ // eslint-disable-line

View File

@@ -6,7 +6,6 @@ import routes from './router.config';
import ZanUI from 'src/index.js';
import packageJson from '../../package.json';
const isProduction = process.env.NODE_ENV === 'production';
const global = {
version: packageJson.version
};
@@ -35,7 +34,7 @@ routesConfig.push({
const router = new VueRouter({
mode: 'history',
base: isProduction ? '/zanui/vue/' : __dirname,
base: '/zanui/vue/',
routes: routesConfig
});
@@ -44,7 +43,7 @@ router.beforeEach((route, redirect, next) => {
window.scrollTo(0, 0);
}
const pathname = isProduction ? '/vue/examples' : '/examples.html';
const pathname = '/zanui/vue/examples';
if (isMobile()) {
window.location.replace(pathname);
return;