[Doc] update mobile index page (#3077)

This commit is contained in:
neverland 2019-04-01 20:56:32 +08:00 committed by GitHub
parent 89ccdfe63b
commit ee5e49bda0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 58 deletions

View File

@ -4,6 +4,7 @@
v-show="title" v-show="title"
class="van-doc-nav-bar" class="van-doc-nav-bar"
:title="title" :title="title"
:border="false"
:left-arrow="showNav" :left-arrow="showNav"
@click-left="onBack" @click-left="onBack"
> >
@ -65,28 +66,24 @@ export default {
body { body {
line-height: 1; line-height: 1;
color: @text-color; color: @text-color;
background-color: #fafafa; background-color: #f2f3f5;
font-family: 'PingFang SC', Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, Arial, sans-serif; font-family: 'PingFang SC', Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
.van-doc-nav-bar { .van-doc-nav-bar {
height: 56px;
line-height: 56px;
.van-nav-bar__title { .van-nav-bar__title {
font-size: 15px; font-size: 18px;
text-transform: capitalize; text-transform: capitalize;
} }
.van-nav-bar__left, .van-icon {
.van-nav-bar__right { font-size: 24px;
cursor: pointer; cursor: pointer;
} color: @gray-dark;
.van-nav-bar__right {
font-size: 16px;
.van-icon {
vertical-align: -3px;
}
} }
} }

View File

@ -1,28 +1,26 @@
<template> <template>
<div class="side-nav"> <div class="side-nav">
<h1 class="zanui-title">
<img src="https://img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png" >
<span>Vant</span>
</h1>
<div class="mobile-switch-lang"> <div class="mobile-switch-lang">
<span
:class="{ active: $vantLang === 'en-US' }"
@click="switchLang('en-US')"
>
EN
</span>
<span <span
:class="{ active: $vantLang === 'zh-CN' }" :class="{ active: $vantLang === 'zh-CN' }"
@click="switchLang('zh-CN')" @click="switchLang('zh-CN')"
> >
中文 中文
</span> </span>
<span
:class="{ active: $vantLang === 'en-US' }"
@click="switchLang('en-US')"
>
EN
</span>
</div> </div>
<h2 class="zanui-desc">{{ description }}</h2>
<template <h1 class="vant-title">
v-for="item in navList" <img src="https://img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png" >
v-if="item.showInMobile" <span>Vant</span>
> </h1>
<h2 class="vant-desc">{{ description }}</h2>
<template v-for="item in navList">
<mobile-nav <mobile-nav
v-for="(group, index) in item.groups" v-for="(group, index) in item.groups"
:group="group" :group="group"
@ -51,7 +49,7 @@ export default {
computed: { computed: {
navList() { navList() {
return this.docConfig[this.$vantLang].nav || []; return (this.docConfig[this.$vantLang].nav || []).filter(item => item.showInMobile);
}, },
description() { description() {
@ -75,16 +73,16 @@ export default {
.side-nav { .side-nav {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 60px 15px 20px; padding: 64px 20px 20px;
.zanui-title, .vant-title,
.zanui-desc { .vant-desc {
text-align: center;
font-weight: normal; font-weight: normal;
user-select: none; user-select: none;
padding-left: 15px;
} }
.zanui-title { .vant-title {
margin: 0 0 15px; margin: 0 0 15px;
img, img,
@ -98,37 +96,50 @@ export default {
} }
span { span {
font-size: 40px; font-size: 36px;
font-weight: 500;
margin-left: 15px; margin-left: 15px;
font-family: "Dosis", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
} }
} }
.zanui-desc { .vant-desc {
font-size: 14px; font-size: 14px;
color: #455a64; color: #7d7e80;
margin: 0 0 60px; margin: 0 0 40px;
} }
} }
.mobile-switch-lang { .mobile-switch-lang {
position: absolute; position: absolute;
top: 15px; top: 24px;
right: 15px; right: 24px;
font-size: 11px;
border: 1px solid @blue;
border-radius: 3px;
color: @blue; color: @blue;
font-size: 12px;
cursor: pointer; cursor: pointer;
overflow: hidden;
span { span {
width: 32px; color: @gray-dark;
width: 48px;
line-height: 22px; line-height: 22px;
text-align: center; text-align: center;
display: inline-block; display: inline-block;
border: 1px solid #dcdee0;
background-color: #f7f8fa;
&:first-child {
border-right: none;
border-radius: 3px 0 0 3px;
}
&:last-child {
border-left: none;
border-radius: 0 3px 3px 0;
}
&.active { &.active {
color: @white; color: @white;
border-color: @blue;
background-color: @blue; background-color: @blue;
} }
} }

View File

@ -1,6 +1,7 @@
<template> <template>
<van-collapse <van-collapse
v-model="active" v-model="active"
:border="false"
class="mobile-nav" class="mobile-nav"
> >
<van-collapse-item <van-collapse-item
@ -8,14 +9,20 @@
:title="group.groupName" :title="group.groupName"
:name="group.groupName" :name="group.groupName"
> >
<van-cell <van-icon
v-if="!navItem.disabled" :name="group.icon"
v-for="(navItem, index) in group.list" slot="right-icon"
:key="index" class="mobile-nav__icon"
:to="'/' + base + navItem.path"
:title="navItem.title"
is-link
/> />
<template v-for="(navItem, index) in group.list">
<van-cell
v-if="!navItem.disabled"
:key="index"
:to="'/' + base + navItem.path"
:title="navItem.title"
is-link
/>
</template>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
</template> </template>
@ -38,11 +45,15 @@ export default {
<style lang="less"> <style lang="less">
.mobile-nav { .mobile-nav {
&__item { &__item {
margin-bottom: 20px; margin-bottom: 16px;
} }
&::after { &__icon {
display: none; font-size: 24px;
img {
width: 100%;
}
} }
.van-collapse-item__content { .van-collapse-item__content {
@ -51,8 +62,10 @@ export default {
.van-collapse-item__title { .van-collapse-item__title {
font-size: 16px; font-size: 16px;
line-height: 36px; font-weight: 500;
line-height: 40px;
align-items: center; align-items: center;
border-radius: 2px;
} }
} }
</style> </style>

View File

@ -77,6 +77,7 @@ module.exports = {
groups: [ groups: [
{ {
groupName: '基础组件', groupName: '基础组件',
icon: 'https://img.yzcdn.cn/vant/basic-0401.svg',
list: [ list: [
{ {
path: '/button', path: '/button',
@ -102,6 +103,7 @@ module.exports = {
}, },
{ {
groupName: '表单组件', groupName: '表单组件',
icon: 'https://img.yzcdn.cn/vant/form-0401.svg',
list: [ list: [
{ {
path: '/checkbox', path: '/checkbox',
@ -163,6 +165,7 @@ module.exports = {
}, },
{ {
groupName: '反馈组件', groupName: '反馈组件',
icon: 'passed',
list: [ list: [
{ {
path: '/actionsheet', path: '/actionsheet',
@ -196,6 +199,7 @@ module.exports = {
}, },
{ {
groupName: '展示组件', groupName: '展示组件',
icon: 'photo-o',
list: [ list: [
{ {
path: '/circle', path: '/circle',
@ -245,6 +249,7 @@ module.exports = {
}, },
{ {
groupName: '导航组件', groupName: '导航组件',
icon: 'https://img.yzcdn.cn/vant/nav-0401.svg',
list: [ list: [
{ {
path: '/badge', path: '/badge',
@ -274,6 +279,7 @@ module.exports = {
}, },
{ {
groupName: '业务组件', groupName: '业务组件',
icon: 'ellipsis',
list: [ list: [
{ {
path: '/address-edit', path: '/address-edit',
@ -378,6 +384,7 @@ module.exports = {
groups: [ groups: [
{ {
groupName: 'Basic Components', groupName: 'Basic Components',
icon: 'https://img.yzcdn.cn/vant/basic-0401.svg',
list: [ list: [
{ {
path: '/button', path: '/button',
@ -403,6 +410,7 @@ module.exports = {
}, },
{ {
groupName: 'Form Components', groupName: 'Form Components',
icon: 'https://img.yzcdn.cn/vant/form-0401.svg',
list: [ list: [
{ {
path: '/checkbox', path: '/checkbox',
@ -464,6 +472,7 @@ module.exports = {
}, },
{ {
groupName: 'Action Components', groupName: 'Action Components',
icon: 'passed',
list: [ list: [
{ {
path: '/actionsheet', path: '/actionsheet',
@ -497,6 +506,7 @@ module.exports = {
}, },
{ {
groupName: 'Display Components', groupName: 'Display Components',
icon: 'photo-o',
list: [ list: [
{ {
path: '/circle', path: '/circle',
@ -546,6 +556,7 @@ module.exports = {
}, },
{ {
groupName: 'Navigation Components', groupName: 'Navigation Components',
icon: 'https://img.yzcdn.cn/vant/nav-0401.svg',
list: [ list: [
{ {
path: '/badge', path: '/badge',
@ -575,6 +586,7 @@ module.exports = {
}, },
{ {
groupName: 'Business Components', groupName: 'Business Components',
icon: 'ellipsis',
list: [ list: [
{ {
path: '/address-edit', path: '/address-edit',

View File

@ -90,18 +90,21 @@ export default {
display: block; display: block;
padding: 0 5px; padding: 0 5px;
font-size: 12px; font-size: 12px;
line-height: 14px; line-height: 18px;
color: @gray-darker;
} }
} }
.van-icon { .van-icon {
font-size: 32px; font-size: 32px;
margin: 15px 0; margin: 20px 0 10px;
color: @text-color; color: @text-color;
} }
.van-tab__pane { .van-tab__pane {
padding-top: 10px; width: auto;
margin: 20px;
background-color: #fff;
} }
} }
</style> </style>