|
11 | 11 | <li class="nav-link-item"><router-link class="nav-link" to="/source">{{language === 'en' ? `Source Code` : `源码`}}</router-link></li>
|
12 | 12 | <li class="nav-link-item" v-if="gitRepoUrl !== null"><a class="nav-link" target="_blank" :href="gitRepoUrl"><img src="../../assets/github.jpeg" class="github-logo">git repos</a></li>
|
13 | 13 | </ul>
|
14 |
| - <div class="search-container"> |
| 14 | + <img src="../../assets/menu.png" alt="" class="menu-button" @click="toggle"> |
| 15 | + <div class="search-container top"> |
15 | 16 | <input type="text" class="search" v-model="keywords" @focus="focus" @blur="blur" :class="[inputing?'active':'']" />
|
16 | 17 | <ul class="result-list" v-show="searchResult.length > 0 && inputing">
|
17 | 18 | <li class="result-item" v-for="result in searchResult">
|
|
29 | 30 | width 100%
|
30 | 31 | top 0
|
31 | 32 | background #fff
|
32 |
| - z-index 1 |
| 33 | + z-index 100 |
33 | 34 | box-shadow 0 0 4px rgba(0,0,0,0.25)
|
34 | 35 | .top-nav
|
35 | 36 | height $header-height
|
36 |
| - padding $header-padding-ver 100px $header-padding-ver 60px |
37 |
| - .search-container |
38 |
| - float right |
39 |
| - position relative |
40 |
| - .search |
41 |
| - height 30px |
42 |
| - line-height 30px |
43 |
| - box-sizing border-box |
44 |
| - padding 0 15px 0 30px |
45 |
| - border 1px solid #e3e3e3 |
46 |
| - color #2c3e50 |
47 |
| - outline none |
48 |
| - border-radius 15px |
49 |
| - margin-right 10px |
50 |
| - margin-top 5px |
51 |
| - transition border-color 0.2s ease |
52 |
| - background #fff url(../../assets/search.png) 8px 5px no-repeat |
53 |
| - background-size 20px |
54 |
| - &.active |
55 |
| - border-color $green |
56 |
| - .result-list |
57 |
| - position absolute |
58 |
| - top 30px |
59 |
| - left 0 |
60 |
| - list-style-type none |
61 |
| - background-color #fff |
62 |
| - border 1px solid #bbb |
63 |
| - border-radius 4px |
64 |
| - font-size 16px |
65 |
| - margin 10px 0 0 |
66 |
| - padding 8px |
67 |
| - text-align left |
68 |
| - a |
69 |
| - color $medium |
70 |
| - &:hover |
71 |
| - color $green |
72 |
| - @media screen and (min-width: 720px) |
| 37 | + padding $header-padding-vertical 100px $header-padding-vertical 60px |
| 38 | + @media screen and (max-width:840px) |
| 39 | + & |
| 40 | + padding $header-padding-vertical-small 1.4em $header-padding-vertical-small 1.4em |
| 41 | + .search-container |
| 42 | + float right |
| 43 | + position relative |
| 44 | + @media screen and (max-width:840px) |
| 45 | + &.top |
| 46 | + display none |
| 47 | + .search |
| 48 | + height 30px |
| 49 | + line-height 30px |
| 50 | + box-sizing border-box |
| 51 | + padding 0 15px 0 30px |
| 52 | + border 1px solid #e3e3e3 |
| 53 | + color #2c3e50 |
| 54 | + outline none |
| 55 | + border-radius 15px |
| 56 | + margin-right 10px |
| 57 | + margin-top 5px |
| 58 | + transition border-color 0.2s ease |
| 59 | + background #fff url(../../assets/search.png) 8px 5px no-repeat |
| 60 | + background-size 20px |
| 61 | + &.active |
| 62 | + border-color $green |
| 63 | + .result-list |
| 64 | + position absolute |
| 65 | + top 30px |
| 66 | + left 0 |
| 67 | + list-style-type none |
| 68 | + background-color #fff |
| 69 | + border 1px solid #bbb |
| 70 | + border-radius 4px |
| 71 | + font-size 16px |
| 72 | + margin 10px 0 0 |
| 73 | + padding 8px |
| 74 | + text-align left |
| 75 | + .result-item |
| 76 | + a |
| 77 | + color $medium |
| 78 | + &:hover |
| 79 | + color $green |
| 80 | + @media screen and (min-width: 720px) |
| 81 | + .top-nav |
73 | 82 | .result-list
|
74 | 83 | width 300px
|
75 | 84 | .nav-logo
|
76 | 85 | display inline-block
|
77 | 86 | .logo
|
78 | 87 | margin-right 6px
|
| 88 | + @media screen and (max-width: 840px) |
| 89 | + & |
| 90 | + margin-left 10px |
79 | 91 | .logo
|
80 | 92 | width 40px
|
81 | 93 | height 40px
|
|
84 | 96 | color $dark
|
85 | 97 | font-family $logo-font
|
86 | 98 | font-weight 500
|
87 |
| - /** |
88 |
| - fixme! 留作以后的slogan样式 |
89 |
| - */ |
90 |
| - /*.slogan |
91 |
| - font-size 1.3em |
92 |
| - color $light |
93 |
| - font-family $logo-font |
94 |
| - font-weight 500*/ |
| 99 | + .menu-button |
| 100 | + float right |
| 101 | + width w = 24px |
| 102 | + height h = w |
| 103 | + margin-top (($header-height - h)/2) |
| 104 | + margin-right 10px |
| 105 | + @media screen and (min-width: 840px) |
| 106 | + & |
| 107 | + display none |
95 | 108 | .nav-link-container
|
96 | 109 | float right
|
97 | 110 | list-style-type none
|
98 | 111 | margin 0
|
99 | 112 | padding 0
|
| 113 | + @media screen and (max-width: 840px) |
| 114 | + & |
| 115 | + display none |
100 | 116 | .nav-link-item
|
101 | 117 | display inline-block
|
102 | 118 | margin 0 .6em
|
|
115 | 131 | <script>
|
116 | 132 | import _ from 'lodash'
|
117 | 133 | import state from '../../store/state'
|
| 134 | + import eventHub from '../../store/event_hub.js' |
118 | 135 | export default{
|
119 | 136 | data () {
|
120 | 137 | return {
|
|
144 | 161 | this.searchResult = searchWithNumber(Number(this.keywords), state.resultJson)
|
145 | 162 | }
|
146 | 163 | }
|
147 |
| - }, 200) |
| 164 | + }, 200), |
| 165 | + toggle () { |
| 166 | + eventHub.$emit('toggle') |
| 167 | + } |
148 | 168 | },
|
149 | 169 | watch: {
|
150 | 170 | 'keywords': function () {
|
|
0 commit comments