Header.vue 5.8 KB

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