Header.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <header class="header" :class="{ 'header-hidden': isHidden }" role="banner">
  3. <div class="header-left">
  4. <a href="/" class="brand" aria-label="Home">
  5. <NuxtPicture src="/logo.png" alt="DDAC logo" class="brand-logo" width="34" height="34"></NuxtPicture>
  6. <h1 class="brand-title">DDAC</h1>
  7. </a>
  8. </div>
  9. <nav class="header-nav" role="navigation" aria-label="Main navigation">
  10. <NuxtLink to="/pc" class="nav-item">首页</NuxtLink>
  11. <div class="nav-item-wrapper">
  12. <div class="nav-item">产品</div>
  13. <div class="dropdown-menu">
  14. <NuxtLink to="/pc/products/sdk" class="dropdown-item">
  15. <img class="item-img" src="~/assets/svg/header/icon1.svg" alt="SDK 安全加固">
  16. <div class="item-text">
  17. <p>SDK 安全加固</p>
  18. <span>三合一:抗 D、消 C、挡 W</span>
  19. </div>
  20. </NuxtLink>
  21. <NuxtLink to="/pc/products/web" class="dropdown-item">
  22. <img class="item-img" src="~/assets/svg/header/icon2.svg" alt="Web 安全加速">
  23. <div class="item-text">
  24. <p>Web 安全加速</p>
  25. <span>部署 30 秒,省心 365 天</span>
  26. </div>
  27. </NuxtLink>
  28. <NuxtLink to="/pc/products/sub3" class="dropdown-item">
  29. <img class="item-img" src="~/assets/svg/header/icon3.svg" alt="DNS 全球解析">
  30. <div class="item-text">
  31. <p>DNS 全球解析</p>
  32. <span>把地球缩成局域网——全球 280+ 节点实时同步</span>
  33. </div>
  34. </NuxtLink>
  35. <NuxtLink to="/pc/products/sub4" class="dropdown-item">
  36. <img class="item-img" src="~/assets/svg/header/icon4.svg" alt="高仿服务器">
  37. <div class="item-text">
  38. <p>高仿服务器</p>
  39. <span>单台扛 1.5T,秒级自动扩容</span>
  40. </div>
  41. </NuxtLink>
  42. </div>
  43. </div>
  44. <NuxtLink to="/pc/solutions" class="nav-item">行业解决方案</NuxtLink>
  45. <NuxtLink to="/pc/docs" class="nav-item">文档中心</NuxtLink>
  46. <NuxtLink to="/pc/about" class="nav-item">了解我们</NuxtLink>
  47. </nav>
  48. <div class="header-right">
  49. <div>登录</div>
  50. <div class="register">注册</div>
  51. </div>
  52. </header>
  53. </template>
  54. <script setup>
  55. const { y: scrollY } = useWindowScroll()
  56. const lastScrollY = ref(0)
  57. const isHidden = ref(false)
  58. watchEffect(() => {
  59. if (scrollY.value > lastScrollY.value && scrollY.value > 60) {
  60. isHidden.value = true
  61. } else {
  62. isHidden.value = false
  63. }
  64. lastScrollY.value = scrollY.value
  65. })
  66. </script>
  67. <style lang="scss">
  68. .header {
  69. box-sizing: border-box;
  70. padding: 22px 0;
  71. display: flex;
  72. justify-content: space-between;
  73. align-items: center;
  74. position: fixed;
  75. top: 0;
  76. left: 0;
  77. right: 0;
  78. z-index: 1000;
  79. background: transparent;
  80. // background: #030014;
  81. transition: transform 0.3s ease;
  82. &.header-hidden {
  83. transform: translateY(-100%);
  84. }
  85. }
  86. .header-left {
  87. flex: 1;
  88. display: flex;
  89. align-items: center;
  90. justify-content: right;
  91. .brand {
  92. display: flex;
  93. align-items: center;
  94. text-decoration: none;
  95. .brand-logo {
  96. margin-right: 8px;
  97. }
  98. .brand-title {
  99. color: #FFF;
  100. font-family: Roboto;
  101. font-size: 30px;
  102. font-style: normal;
  103. font-weight: 700;
  104. line-height: 36px;
  105. }
  106. }
  107. }
  108. .header-nav {
  109. flex: 2;
  110. display: flex;
  111. justify-content: center;
  112. align-items: center;
  113. .nav-item {
  114. text-decoration: none;
  115. margin: 0 15px;
  116. cursor: pointer;
  117. color: #FFF;
  118. font-size: 16px;
  119. font-style: normal;
  120. font-weight: 400;
  121. line-height: 16px;
  122. &:hover {
  123. // color: #000;
  124. }
  125. }
  126. }
  127. .header-right {
  128. flex: 1;
  129. display: flex;
  130. align-items: center;
  131. justify-content: left;
  132. color: #FFF;
  133. font-size: 16px;
  134. div {
  135. margin-left: 20px;
  136. cursor: pointer;
  137. }
  138. .register {
  139. display: flex;
  140. width: 100px;
  141. height: 40px;
  142. justify-content: center;
  143. align-items: center;
  144. gap: 10px;
  145. border-radius: 10px;
  146. border: 1px solid #7D46FF;
  147. background: #030014;
  148. box-shadow: 0.5px 0.5px 18px 0 rgba(125, 70, 255, 0.45) inset;
  149. }
  150. }
  151. .nav-item-wrapper {
  152. position: relative;
  153. display: flex;
  154. align-items: center;
  155. height: 100%;
  156. &:hover .dropdown-menu {
  157. opacity: 1;
  158. visibility: visible;
  159. transform: translate(-50%, 30px);
  160. }
  161. }
  162. .dropdown-menu {
  163. position: absolute;
  164. display: flex;
  165. flex-direction: column;
  166. top: 100%;
  167. left: 50%;
  168. transform: translate(-50%, 0);
  169. border-radius: 4px;
  170. min-width: 284px;
  171. opacity: 0;
  172. border-top: 1px solid #7D46FF;
  173. background: rgba(63, 63, 63, 0.60);
  174. visibility: hidden;
  175. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  176. backdrop-filter: blur(30px);
  177. z-index: 1001;
  178. margin-top: 5px;
  179. .dropdown-item {
  180. padding: 12px;
  181. display: flex;
  182. align-items: center;
  183. color: #FFF;
  184. text-decoration: none;
  185. font-size: 14px;
  186. transition: background 0.2s, color 0.2s;
  187. text-align: center;
  188. gap: 24px;
  189. &:hover {
  190. background: rgba(255, 255, 255, 0.1);
  191. }
  192. .item-img {
  193. width: 34px;
  194. height: 34px;
  195. }
  196. .item-text {
  197. display: flex;
  198. flex-direction: column;
  199. justify-content: center;
  200. align-items: flex-start;
  201. gap: 10px;
  202. p {
  203. color: #FFF;
  204. font-size: 16px;
  205. font-style: normal;
  206. font-weight: 500;
  207. line-height: 16px;
  208. }
  209. span {
  210. color: rgba(255, 255, 255, 0.60);
  211. font-size: 14px;
  212. font-style: normal;
  213. font-weight: 400;
  214. line-height: 22px;
  215. text-align: left;
  216. }
  217. }
  218. }
  219. }
  220. </style>