Header.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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">{{ title }}</h1>
  7. </a>
  8. </div>
  9. <nav class="header-nav" role="navigation" aria-label="Main navigation">
  10. <NuxtLink to="/web" 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="/web/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="/web/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="/web/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="/web/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="/web/solutions" class="nav-item">行业解决方案</NuxtLink>
  48. <NuxtLink to="/web/docs" class="nav-item">文档中心</NuxtLink> -->
  49. <NuxtLink to="/web/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 title = import.meta.env.VITE_APP_NAME
  59. const { y: scrollY } = useWindowScroll()
  60. const lastScrollY = ref(0)
  61. const isHidden = ref(false)
  62. watchEffect(() => {
  63. if (scrollY.value > lastScrollY.value && scrollY.value > 60) {
  64. isHidden.value = true
  65. } else {
  66. isHidden.value = false
  67. }
  68. lastScrollY.value = scrollY.value
  69. })
  70. </script>
  71. <style lang="scss" scoped>
  72. .header {
  73. box-sizing: border-box;
  74. padding: 22px 0;
  75. display: flex;
  76. justify-content: space-between;
  77. align-items: center;
  78. position: fixed;
  79. top: 0;
  80. left: 0;
  81. right: 0;
  82. z-index: 1000;
  83. // background: transparent;
  84. background: #030014;
  85. transition: transform 0.3s ease;
  86. &.header-hidden {
  87. transform: translateY(-100%);
  88. }
  89. }
  90. .header-left {
  91. flex: 1;
  92. display: flex;
  93. align-items: center;
  94. justify-content: right;
  95. .brand {
  96. display: flex;
  97. align-items: center;
  98. text-decoration: none;
  99. .brand-logo {
  100. margin-right: 8px;
  101. }
  102. .brand-title {
  103. color: #FFF;
  104. font-size: 30px;
  105. font-style: normal;
  106. font-weight: 700;
  107. line-height: 36px;
  108. }
  109. }
  110. }
  111. .header-nav {
  112. flex: 2;
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. .nav-item {
  117. display: flex;
  118. align-items: center;
  119. gap: 4px;
  120. text-decoration: none;
  121. margin: 0 15px;
  122. cursor: pointer;
  123. color: #FFF;
  124. font-size: 16px;
  125. font-style: normal;
  126. font-weight: 400;
  127. line-height: 16px;
  128. &:hover {
  129. // color: #000;
  130. }
  131. }
  132. }
  133. .nav-item-icon {
  134. transition: transform 0.3s ease;
  135. }
  136. .nav-item-wrapper:hover .nav-item-icon {
  137. transform: rotate(180deg);
  138. }
  139. .header-right {
  140. flex: 1;
  141. display: flex;
  142. align-items: center;
  143. justify-content: left;
  144. color: #FFF;
  145. font-size: 16px;
  146. div {
  147. margin-left: 20px;
  148. cursor: pointer;
  149. }
  150. .register {
  151. display: flex;
  152. width: 100px;
  153. height: 40px;
  154. justify-content: center;
  155. align-items: center;
  156. gap: 10px;
  157. border-radius: 10px;
  158. border: 1px solid #7D46FF;
  159. background: #030014;
  160. box-shadow: 0.5px 0.5px 18px 0 rgba(125, 70, 255, 0.45) inset;
  161. }
  162. }
  163. .nav-item-wrapper {
  164. position: relative;
  165. display: flex;
  166. align-items: center;
  167. height: 100%;
  168. &:hover .dropdown-menu {
  169. opacity: 1;
  170. visibility: visible;
  171. transform: translate(-50%, 30px);
  172. }
  173. }
  174. .dropdown-menu {
  175. position: absolute;
  176. display: flex;
  177. flex-direction: column;
  178. top: 100%;
  179. left: 50%;
  180. transform: translate(-50%, 0);
  181. border-radius: 4px;
  182. min-width: 284px;
  183. opacity: 0;
  184. border-top: 1px solid #7D46FF;
  185. background: rgba(63, 63, 63, 0.60);
  186. visibility: hidden;
  187. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  188. backdrop-filter: blur(30px);
  189. z-index: 1001;
  190. margin-top: 5px;
  191. .dropdown-item {
  192. padding: 12px;
  193. display: flex;
  194. align-items: center;
  195. color: #FFF;
  196. text-decoration: none;
  197. font-size: 14px;
  198. transition: background 0.2s, color 0.2s;
  199. text-align: center;
  200. gap: 24px;
  201. &:hover {
  202. background: rgba(255, 255, 255, 0.1);
  203. }
  204. .item-img {
  205. width: 34px;
  206. height: 34px;
  207. }
  208. .item-text {
  209. display: flex;
  210. flex-direction: column;
  211. justify-content: center;
  212. align-items: flex-start;
  213. gap: 10px;
  214. p {
  215. color: #FFF;
  216. font-size: 16px;
  217. font-style: normal;
  218. font-weight: 500;
  219. line-height: 16px;
  220. }
  221. span {
  222. color: rgba(255, 255, 255, 0.60);
  223. font-size: 14px;
  224. font-style: normal;
  225. font-weight: 400;
  226. line-height: 22px;
  227. text-align: left;
  228. }
  229. }
  230. }
  231. }
  232. </style>