Header.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <header class="fixed top-0 z-100 w-full lg:bg-white" :class="[scrollTop && 'border-b-1px border-b-[#CDDFFF]',show ? '<lg:h-100vh bg-black' : 'bg-white <lg:h-66px <lg:overflow-hidden']">
  3. <div class="container relative lg:flex lg:items-center">
  4. <div class="<lg:flex <lg:justify-between <lg:items-center <lg:py-17px">
  5. <a class="flex items-center lg:mr-28px" href="/">
  6. <Logo class="<lg:w-32px <lg:h-32px" />
  7. <span class="font-bold lg:ml-10px <lg:ml-8px <lg:text-20px <lg:leading-24px" :class="show && 'text-white'">ComPDFKit</span>
  8. </a>
  9. <div class="pro-icon-container lg:hidden <lg:inline-block p-3px cursor-pointer" :class="{active: show}" @click="toggleMenu">
  10. <div class="line-container w-14px h-14px">
  11. <div class="line relative w-14px h-2px" :class="show ? 'bg-white' : 'bg-black'"></div>
  12. <div class="line relative top-4px w-14px h-2px" :class="show ? 'bg-white' : 'bg-black'"></div>
  13. <div class="line relative top-8px w-14px h-2px" :class="show ? 'bg-white' : 'bg-black'"></div>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="relative left-1/2 w-[100vw] transform translate-x-[-50%] h-1px lg:hidden bg-white/20" :class="{ active: show }"></div>
  18. <div class="lg:flex lg:items-center lg:flex-1">
  19. <nav class="lg:relative lg:flex text-brand-1 px-28px">
  20. <Link
  21. class="<lg:block font-bold lg:text-sm lg:mr-50px lg:py-28px <lg:py-20px lg:px-2px <lg:text-14px <lg:leading-20px <lg:text-white lg:hover:text-brand-0 <lg:border-b-1px <lg:border-[#2F2F2F]"
  22. href="/"
  23. >首页</Link>
  24. </nav>
  25. <div class="flex lg:flex-1 lg:justify-end <lg:justify-center <lg:items-center <lg:mt-50px <tiny:px-10px">
  26. <LinkButton type="plain" primary bold class="!@md:max-w-332px !@tiny:max-w-242px !@sm:max-w-240px <lg:mr-16px bg-brand-0 text-white text-sm lg:mr-12px" href="/contact-sales">获取报价</LinkButton>
  27. <LinkButton type="border" primary bold class="!@md:max-w-332px !@tiny:max-w-242px !@sm:max-w-240px border border-brand-0 text-brand-0" href="javascript:;">联系我们</LinkButton>
  28. </div>
  29. </div>
  30. </div>
  31. </header>
  32. </template>
  33. <script>
  34. import Logo from '~/assets/images/icons/logo.svg?inline'
  35. import Arrow from '~/assets/images/icons/arrow.svg?inline'
  36. import Contact from '~/assets/images/icons/contact.svg?inline'
  37. export default {
  38. components: {
  39. Logo,
  40. Arrow,
  41. Contact
  42. },
  43. props: {
  44. platform: {
  45. default: 'iOS'
  46. }
  47. },
  48. data () {
  49. return {
  50. tabPlatform: 'Mac',
  51. scrollTop: false,
  52. activeTag: '',
  53. show: false
  54. }
  55. },
  56. computed: {
  57. pdfSdkActive () {
  58. return ['pdf-sdk'].includes(this.$route.name)
  59. },
  60. pdfConversionSdkActive () {
  61. return ['pdf-conversion-sdk'].includes(this.$route.name)
  62. },
  63. productsActive () {
  64. return this.pdfSdkActive || this.pdfConversionSdkActive || this.$route.name.indexOf('pdf-sdk') === 0
  65. },
  66. documentActive () {
  67. return 'guides-platform' === this.$route.name
  68. },
  69. blogActive () {
  70. return 'blog' === this.$route.name.split('-')[0]
  71. }
  72. },
  73. mounted () {
  74. window.addEventListener('scroll', this.onScroll)
  75. this.onScroll()
  76. },
  77. methods: {
  78. onScroll () {
  79. this.scrollTop = window.scrollY > 0
  80. },
  81. toggleDropMenu (tag) {
  82. if (this.activeTag) {
  83. this.activeTag = this.activeTag === tag ? '' : tag
  84. } else {
  85. this.activeTag = tag
  86. }
  87. },
  88. toggleMenu () {
  89. this.show = !this.show
  90. },
  91. checkActive (platform) {
  92. return this.documentActive && this.$route.params.platform === platform
  93. },
  94. handleDocument (tabPlatform) {
  95. if (this.tabPlatform === tabPlatform) return
  96. this.tabPlatform = tabPlatform
  97. }
  98. },
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .line {
  103. transition: transform 0.2s linear 0s, top 0.2s linear 0s;
  104. &:first-child.bg-white {
  105. transform: rotate(45deg);
  106. top: 6px;
  107. }
  108. &:nth-child(2).bg-white {
  109. opacity: 0;
  110. }
  111. &:nth-child(3).bg-white {
  112. top: 2px;
  113. transform: rotate(-45deg);
  114. }
  115. }
  116. @media screen and (min-width: 930px) {
  117. .dropdown:hover .dropdown-menu {
  118. display: flex;
  119. }
  120. .dropdown:hover .arrow {
  121. transition: transform 0.2s linear 0s, top 0.2s linear 0s;
  122. transform: rotate(90deg);
  123. -ms-transform: rotate(90deg); /* IE 9 */
  124. -moz-transform: rotate(90deg); /* Firefox */
  125. -webkit-transform: rotate(90deg); /* Safari 和 Chrome */
  126. -o-transform: rotate(90deg);
  127. }
  128. .dropdown-menu {
  129. box-shadow: 0px 4px 50px rgba(0, 0, 0, 0.1);
  130. }
  131. .dropdown-sdk:hover {
  132. > a {
  133. background-color: #F8FAFF;
  134. color: #1460F3;
  135. }
  136. div {
  137. display: flex;
  138. }
  139. }
  140. }
  141. @media screen and (min-width: 1280px) {
  142. .container {
  143. max-width: 1320px;
  144. }
  145. }
  146. </style>