Header.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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-size: 30px;
  101. font-style: normal;
  102. font-weight: 700;
  103. line-height: 36px;
  104. }
  105. }
  106. }
  107. .header-nav {
  108. flex: 2;
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. .nav-item {
  113. text-decoration: none;
  114. margin: 0 15px;
  115. cursor: pointer;
  116. color: #FFF;
  117. font-size: 16px;
  118. font-style: normal;
  119. font-weight: 400;
  120. line-height: 16px;
  121. &:hover {
  122. // color: #000;
  123. }
  124. }
  125. }
  126. .header-right {
  127. flex: 1;
  128. display: flex;
  129. align-items: center;
  130. justify-content: left;
  131. color: #FFF;
  132. font-size: 16px;
  133. div {
  134. margin-left: 20px;
  135. cursor: pointer;
  136. }
  137. .register {
  138. display: flex;
  139. width: 100px;
  140. height: 40px;
  141. justify-content: center;
  142. align-items: center;
  143. gap: 10px;
  144. border-radius: 10px;
  145. border: 1px solid #7D46FF;
  146. background: #030014;
  147. box-shadow: 0.5px 0.5px 18px 0 rgba(125, 70, 255, 0.45) inset;
  148. }
  149. }
  150. .nav-item-wrapper {
  151. position: relative;
  152. display: flex;
  153. align-items: center;
  154. height: 100%;
  155. &:hover .dropdown-menu {
  156. opacity: 1;
  157. visibility: visible;
  158. transform: translate(-50%, 30px);
  159. }
  160. }
  161. .dropdown-menu {
  162. position: absolute;
  163. display: flex;
  164. flex-direction: column;
  165. top: 100%;
  166. left: 50%;
  167. transform: translate(-50%, 0);
  168. border-radius: 4px;
  169. min-width: 284px;
  170. opacity: 0;
  171. border-top: 1px solid #7D46FF;
  172. background: rgba(63, 63, 63, 0.60);
  173. visibility: hidden;
  174. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  175. backdrop-filter: blur(30px);
  176. z-index: 1001;
  177. margin-top: 5px;
  178. .dropdown-item {
  179. padding: 12px;
  180. display: flex;
  181. align-items: center;
  182. color: #FFF;
  183. text-decoration: none;
  184. font-size: 14px;
  185. transition: background 0.2s, color 0.2s;
  186. text-align: center;
  187. gap: 24px;
  188. &:hover {
  189. background: rgba(255, 255, 255, 0.1);
  190. }
  191. .item-img {
  192. width: 34px;
  193. height: 34px;
  194. }
  195. .item-text {
  196. display: flex;
  197. flex-direction: column;
  198. justify-content: center;
  199. align-items: flex-start;
  200. gap: 10px;
  201. p {
  202. color: #FFF;
  203. font-size: 16px;
  204. font-style: normal;
  205. font-weight: 500;
  206. line-height: 16px;
  207. }
  208. span {
  209. color: rgba(255, 255, 255, 0.60);
  210. font-size: 14px;
  211. font-style: normal;
  212. font-weight: 400;
  213. line-height: 22px;
  214. text-align: left;
  215. }
  216. }
  217. }
  218. }
  219. </style>