viewport.vue 2.9 KB
Newer Older
M
init  
miaodian 已提交
1 2
<template>
  <div class="docs-view">
F
funanamy 已提交
3 4 5
    <img v-show="!showCatalog" class="toggle-catalog" @click="toggleCatalog" src="./catalog.svg"/>
    <div class="nav-list-wrapper" :class="{ active: showCatalog }">
      <img v-show="showCatalog" class="active-toggle-catalog" @click="toggleCatalog" src="./catalog.svg"/>
A
AmyFoxFN 已提交
6 7
      <side-list :nav-list="navList"></side-list>
    </div>
F
update  
funanamy 已提交
8
    <div v-show="showCatalog" class="mask" :class="{ active: showCatalog }" @click="toggleCatalog"></div>
F
funanamy 已提交
9
    <router-view class="page-doc md-body" v-highlight></router-view>
D
sync  
dolymood 已提交
10
    <display></display>
M
init  
miaodian 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
  </div>
</template>

<script>
  import SideList from '../side-list/side-list.vue'
  import Display from '../display/display.vue'
  import menuConfig from '../../common/config/menu'

  export default {
    props: {
      lang: {
        type: String,
        default: 'zh-CN'
      }
    },
    data() {
      return {
A
AmyFoxFN 已提交
28
        navList: menuConfig[this.lang],
F
funanamy 已提交
29
        showCatalog: false
A
AmyFoxFN 已提交
30 31
      }
    },
F
funanamy 已提交
32 33 34 35 36
    watch: {
      $route() {
        this.showCatalog = false
      }
    },
F
funanamy 已提交
37 38 39 40 41
    methods: {
      toggleCatalog() {
        this.showCatalog = !this.showCatalog
      }
    },
M
init  
miaodian 已提交
42 43 44 45 46 47 48 49
    components: {
      SideList,
      Display
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus">
A
AmyFoxFN 已提交
50 51
  @import "~@/common/stylus/variable.styl"

M
init  
miaodian 已提交
52 53 54 55
  .docs-view
    display: flex
    width: 100%
    height: 100%
A
AmyFoxFN 已提交
56
    flex-wrap: wrap
F
funanamy 已提交
57
    overflow: hidden
F
funanamy 已提交
58 59 60 61
    @media screen and (max-width: 960px)
      position: relative
      height: auto
    .toggle-catalog
F
funanamy 已提交
62 63 64
      display: none
      @media screen and (max-width: 960px)
        display: block
F
funanamy 已提交
65 66 67
        position: absolute
        right: 20px
        top: 20px
A
AmyFoxFN 已提交
68 69
    .nav-list-wrapper
      @media screen and (max-width: 960px)
F
funanamy 已提交
70 71 72
        width: 100%
        position: absolute
        right: -100%
F
funanamy 已提交
73 74
        top: 0
        height: 100%
F
funanamy 已提交
75 76
        background-color: $color-white
        z-index: 1
A
AmyFoxFN 已提交
77
        overflow: hidden
F
funanamy 已提交
78
        transition: all 0.4s ease
F
funanamy 已提交
79 80 81 82 83 84 85 86 87 88
        &.active
          transform: translate(-70%, 0)
        .active-toggle-catalog
          margin: 20px 0 0 20px
    .mask
      position: absolute
      top: 0
      left: 0
      width: 100%
      height: 100%
F
funanamy 已提交
89
      transition: all 0.4s ease
F
update  
funanamy 已提交
90 91
      &.active
        background-color: rgba(0, 0, 0 ,0.2)
M
init  
miaodian 已提交
92
  .page-sidelist
F
funanamy 已提交
93 94 95 96
    flex: none
    width: 190px
    height: 100%
    padding: 40px 20px
M
init  
miaodian 已提交
97 98
    box-sizing: border-box
    overflow-y: auto
F
funanamy 已提交
99 100 101 102
    @media screen and (max-width: 960px)
      width: 70%
      height: 100%
      padding: 5px 20px
M
init  
miaodian 已提交
103
  .page-doc
F
funanamy 已提交
104 105 106
    flex: 1
    height: 100%
    padding: 44px 20px 20px 20px
M
init  
miaodian 已提交
107 108
    box-sizing: border-box
    overflow-y: auto
F
funanamy 已提交
109 110 111 112
    @media screen and (max-width: 960px)
      flex: 1 1 100%
      height: auto
      padding: 20px 20px 0 20px
D
sync  
dolymood 已提交
113 114
    h2:first-child
      margin-top: 0
M
init  
miaodian 已提交
115 116
  .page-display
    flex: none
F
funanamy 已提交
117
    height: 100%
M
init  
miaodian 已提交
118 119
    width: 420px
    overflow-y: auto
F
funanamy 已提交
120 121 122
    @media screen and (max-width: 960px)
      flex: 1 1 100%
      height: 800px
M
init  
miaodian 已提交
123
</style>