IphHeader.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!--
  2. * @Descripttion: 头部导航栏
  3. * @version: 1.0.0
  4. * @Author: dream
  5. * @Date: 2021-04-09 14:17:59
  6. * @LastEditors: dream
  7. * @LastEditTime: 2021-04-09 15:20:07
  8. -->
  9. <template>
  10. <div class="header">
  11. <div class="line">
  12. <div class="line-title">{{$t('index.headerTitle')}}</div>
  13. <div class="call-me">{{$t('index.contactUs')}}</div>
  14. </div>
  15. <div class="nav">
  16. <img class="logo-img" src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2939464207,3798916386&fm=26&gp=0.jpg" />
  17. <ul class="nav-menu-list">
  18. <li :class="currentNav === index ? 'active' : ''" v-for="(item, index) in navList" :key="index" @click="changeNavTab(index)">{{$t(item)}}</li>
  19. </ul>
  20. <div class="local">
  21. <span :class="local === 'zh_c' ? 'active' : ''" @click="chengeLanguage('zh_c')">CH</span>
  22. <span>|</span>
  23. <span :class="local === 'en' ? 'active' : ''" @click="chengeLanguage('en')">EN</span>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. name: 'IphHeader',
  31. data () {
  32. return {
  33. local: 'zh_c',
  34. currentNav: 0,
  35. navList: [
  36. 'index.nav[0]',
  37. 'index.nav[1]',
  38. 'index.nav[2]',
  39. 'index.nav[3]',
  40. 'index.nav[4]',
  41. 'index.nav[5]'
  42. ]
  43. }
  44. },
  45. methods: {
  46. changeNavTab (index) {
  47. this.currentNav = index
  48. },
  49. chengeLanguage (val) {
  50. this.local = val
  51. this.$i18n.locale = val
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .header {
  58. .line {
  59. padding: 12px;
  60. display: flex;
  61. align-items: center;
  62. .line-title {
  63. flex: 1;
  64. text-align: center;
  65. }
  66. .call-me {
  67. color: '#169BD5';
  68. cursor: pointer;
  69. }
  70. }
  71. .nav {
  72. display: flex;
  73. align-items: center;
  74. padding: 0 32px;
  75. .logo-img {
  76. width: 90px;
  77. height: 70px;
  78. }
  79. .nav-menu-list {
  80. flex: 1;
  81. display: flex;
  82. align-items: center;
  83. justify-content: space-around;
  84. list-style: none;
  85. li {
  86. padding: 24px;
  87. color: #55C0EE;
  88. cursor: pointer;
  89. }
  90. .active {
  91. font-weight: 600;
  92. color: #169BD5;
  93. }
  94. }
  95. .local {
  96. display: flex;
  97. align-items: center;
  98. span {
  99. padding: 6px;
  100. cursor: pointer;
  101. }
  102. .active {
  103. color: #169BD5;
  104. }
  105. }
  106. }
  107. }
  108. </style>