App.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div id="app">
  3. <div class="topNav">
  4. <div id="nav" role="navigation">
  5. <div id="home_tab" class="liubai">
  6. <img src="./assets/logo.png" alt />
  7. <div id="nav-a">
  8. <router-link to="/">首页</router-link>
  9. <router-link to="/serve">服务</router-link>
  10. <router-link to="/teach">人才培养</router-link>
  11. <router-link to="/news">新闻</router-link>
  12. <router-link to="/about">关于我们</router-link>
  13. </div>
  14. <img
  15. src=".\assets\menu.png"
  16. alt="切换目录"
  17. @click="aaa = !aaa"
  18. class="phonemenu"
  19. style="width:32px !important;height:18px !important;"
  20. />
  21. <div type="button" :class="{ showmenu: aaa, switching: true }" @click="aaa = !aaa">
  22. <ul>
  23. <li>
  24. <router-link to="/">
  25. 首页
  26. <span class="sr-only">切换导航</span>
  27. </router-link>
  28. </li>
  29. <li>
  30. <router-link to="/serve">
  31. 服务
  32. <span class="icon-bar"></span>
  33. </router-link>
  34. </li>
  35. <li>
  36. <router-link to="/teach">人才培养</router-link>
  37. </li>
  38. <li>
  39. <router-link to="/news">新闻</router-link>
  40. </li>
  41. <li>
  42. <router-link to="/about">关于我们</router-link>
  43. </li>
  44. </ul>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="fenge"></div>
  49. <router-view />
  50. </div>
  51. </div>
  52. </template>
  53. <style lang="stylus">
  54. @media only screen and (max-width: 479px) {
  55. .fenge {
  56. height: 40px !important;
  57. backgroundColor: blue;
  58. }
  59. #nav {
  60. height: 40px !important;
  61. }
  62. #nav img {
  63. width: 80px !important;
  64. height: 18px !important;
  65. margin: 10px 31px !important;
  66. margin-left: 0px !important;
  67. }
  68. #nav-a {
  69. height: 40px !important;
  70. line-height: 40px !important;
  71. margin-right: 31px !important;
  72. }
  73. #nav-a a {
  74. width: 38px !important;
  75. font-size: 12px;
  76. height: 40px !important;
  77. overflow: hidden;
  78. &.router-link-exact-active {
  79. width: 38px !important;
  80. }
  81. }
  82. }
  83. @media only screen and (min-width: 479px) {
  84. #nav {
  85. width: 100% !important;
  86. }
  87. }
  88. @media only screen and (max-width: 1440px) {
  89. #nav {
  90. width: 100% !important;
  91. }
  92. .liubai {
  93. width: 83.3% !important;
  94. margin: auto 8.3% !important;
  95. }
  96. }
  97. @media only screen and (max-width: 661px) {
  98. #nav-a {
  99. display: none !important;
  100. }
  101. .phonemenu {
  102. display: block !important;
  103. }
  104. }
  105. @media only screen and (min-width: 661px) {
  106. .switching, .showmenu {
  107. display: none;
  108. }
  109. }
  110. .fenge {
  111. height: 80px;
  112. backgroundColor: blue;
  113. }
  114. .phonemenu {
  115. display: none;
  116. position: absolute;
  117. right: 0px;
  118. z-index: 999;
  119. }
  120. .showmenu {
  121. display: none;
  122. }
  123. .switching {
  124. position: absolute;
  125. right: 19px;
  126. top: 0px;
  127. background-image: linear-gradient(-90deg, #f5fffd 0%, #1b1b1d00 100%);
  128. border-radius: 2%;
  129. padding-top: 40px;
  130. }
  131. .switching li {
  132. padding-bottom: 6px !important;
  133. }
  134. .liubai {
  135. width: 1200px;
  136. margin: 0 auto;
  137. }
  138. #app {
  139. font-family: 'Avenir', Helvetica, Arial, sans-serif;
  140. -webkit-font-smoothing: antialiased;
  141. -moz-osx-font-smoothing: grayscale;
  142. text-align: center;
  143. color: #2c3e50;
  144. }
  145. #nav {
  146. padding: 0px;
  147. background: #FFFFFF;
  148. position: fixed;
  149. top: 0px;
  150. z-index: 999;
  151. }
  152. #home_tab {
  153. display: flex;
  154. // justify-content: space-between;
  155. }
  156. #nav-a {
  157. height: 80px;
  158. line-height: 80px;
  159. display: flex;
  160. a {
  161. font-family: PingFangSC-Regular;
  162. font-size: 18px;
  163. color: #4A4A4A;
  164. letter-spacing: 0;
  165. text-decoration: none;
  166. width: 110px;
  167. height: 80px;
  168. text-align: center;
  169. &.router-link-exact-active {
  170. color: #FFFFFF;
  171. width: 100px;
  172. height: 80px;
  173. text-align: center;
  174. background-image: linear-gradient(-90deg, #30D5FF 0%, #749CF7 100%);
  175. }
  176. }
  177. }
  178. #nav img {
  179. width: 161px;
  180. height: 36px;
  181. margin-top: 15px;
  182. margin-bottom: 29px;
  183. margin-right: 515px;
  184. }
  185. </style>
  186. <script>
  187. /* eslint-disable */
  188. document.getElementsByTagName("html")[0].style.fontSize=document.body.clientWidth/200+'px'
  189. export default {
  190. name: "app",
  191. data() {
  192. return {
  193. aaa: true,
  194. screenWidth: document.body.clientWidth
  195. };
  196. },
  197. mounted() {
  198. const that = this;
  199. window.onresize = () => {
  200. // console.log("object");
  201. return (() => {
  202. window.screenWidth = document.body.clientWidth;
  203. that.screenWidth = window.screenWidth;
  204. document.getElementsByTagName("html")[0].style.fontSize=screenWidth/200+'px';
  205. })();
  206. };
  207. },
  208. };
  209. </script>