footer.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="footer-menu">
  3. <AppLink v-for="item in menuList" :key="item.name" :to="{ name: item.routeName }" tag="div" class="app-link"
  4. :class="setClass(item)" >
  5. <div v-if="item.routeName === 'home'" class="home-icon" :style="{
  6. backgroundImage:
  7. activeRoute == item.routeName
  8. ? `url(${require('@/assets/images/layout/footer/center_.png')})`
  9. : `url(${require('@/assets/images/layout/footer/center.png')})`,
  10. }"></div>
  11. <div class="relative-text">
  12. {{ item.name }}
  13. </div>
  14. </AppLink>
  15. </div>
  16. </template>
  17. <script>
  18. import AppLink from './components/AppLink.vue';
  19. export default {
  20. name: 'FooterMenu',
  21. components: {
  22. AppLink,
  23. },
  24. data () {
  25. return {
  26. menuList: [
  27. {
  28. name: '源',
  29. routeName: 'source',
  30. className: 'leftC',
  31. activeClass: 'leftC-active',
  32. },
  33. // {
  34. // name: '储',
  35. // routeName: 'storage',
  36. // images: require('@/assets/images/layout/footer/iteml.png'),
  37. // imagesActive: require('@/assets/images/layout/footer/iteml_.png'),
  38. // },
  39. {
  40. name: '荷',
  41. routeName: 'soc',
  42. className: 'leftC',
  43. activeClass: 'leftC-active',
  44. },
  45. {
  46. name: '首页',
  47. routeName: 'home',
  48. className:'home',
  49. },
  50. {
  51. name: '网',
  52. routeName: 'net',
  53. className: 'rightC',
  54. activeClass: 'rightC-active',
  55. },
  56. {
  57. name: '设备',
  58. routeName: 'device',
  59. className: 'net-device rightC',
  60. activeClass: 'rightC-active',
  61. },
  62. ],
  63. };
  64. },
  65. computed: {
  66. activeRoute () {
  67. return this.$route.name;
  68. },
  69. },
  70. methods: {
  71. setClass (item) {
  72. return this.activeRoute===item.routeName?`${item.className} ${item.activeClass||''}`:`${item.className}`
  73. }
  74. },
  75. };
  76. </script>
  77. <style lang="scss" scoped>
  78. $footer-height: 60px;
  79. .footer-menu {
  80. width: calc(40% + 10px);
  81. height: $footer-height;
  82. display: flex;
  83. align-items: center;
  84. justify-content: center;
  85. padding-top: 2px;
  86. padding-left: 10px;
  87. padding-right: 14px;
  88. pointer-events: auto;
  89. .app-link {
  90. position: relative;
  91. display: flex;
  92. justify-content: center;
  93. align-items: center;
  94. font-size: large;
  95. ::v-deep a{
  96. width: 100%;
  97. text-align: center;
  98. }
  99. &.home {
  100. width: 121px;
  101. height: 37px;
  102. margin-top: 1px;
  103. background-repeat: no-repeat;
  104. }
  105. &.net-device {
  106. padding-left: 20px;
  107. }
  108. &.leftC{
  109. width: 103px;
  110. height: 37px;
  111. padding-right: 20px;
  112. background: url("~@/assets/images/layout/footer/iteml.png") no-repeat;
  113. background-size:100%;
  114. }
  115. &.leftC-active{
  116. background: url("~@/assets/images/layout/footer/iteml_.png") no-repeat;
  117. background-size:100%;
  118. }
  119. &.rightC{
  120. width: 103px;
  121. height: 37px;
  122. background: url("~@/assets/images/layout/footer/itemr.png") no-repeat;
  123. background-size:100% 100%;
  124. }
  125. &.rightC-active{
  126. background: url("~@/assets/images/layout/footer/itemr_.png") no-repeat;
  127. background-size:100% 100%;
  128. }
  129. .home-icon {
  130. content: "";
  131. position: absolute;
  132. width: 77px;
  133. height: 77px;
  134. animation: spin-slow infinite 4s linear;
  135. top: -20px;
  136. left: 21px;
  137. background-position: center;
  138. background-size: cover;
  139. z-index: 10;
  140. }
  141. .relative-text {
  142. position: relative;
  143. color: #fff;
  144. z-index: 10;
  145. }
  146. }
  147. }
  148. @keyframes spin-slow {
  149. from {
  150. transform: rotate(0deg);
  151. }
  152. to {
  153. transform: rotate(360deg);
  154. }
  155. }
  156. </style>