Headers.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div>
  3. <div class="header">
  4. <div class="title-card">
  5. <li class="bg-img" @click="ConfirmBtn(1)" :class="getClass(1)">
  6. <img src="../assets/Vector.png" alt="">
  7. <linear-text text="总览" startColor="#95CCFF" endColor="#fff"
  8. fontSize="20px" />
  9. </li>
  10. <ul v-for="(item,index) in titleList" :key="index">
  11. <li class="bg-img" @click="ConfirmBtn(item.id)" :class="getClass(item.id)">
  12. <linear-text :text="item.name" startColor="#95CCFF" endColor="#fff"
  13. fontSize="20px"
  14. /></li>
  15. </ul>
  16. </div>
  17. <div class="title-card">
  18. <ul v-for="(item,index) in titleList1" :key="index" >
  19. <li class="bg-img" @click="ConfirmBtn(item.id)" :class="getClass(item.id)"> <linear-text :text="item.name" startColor="#95CCFF" endColor="#fff"
  20. fontSize="20px"
  21. /></li>
  22. </ul>
  23. <li class="bg-img" @click="ConfirmBtn(8)" :class="getClass(8)">
  24. <img src="../assets/out.png" alt="">
  25. </li>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script >
  31. import Image1 from '../assets/fxyj2.png'
  32. import Image2 from '../assets/fxyj4.png'
  33. import Image3 from '../assets/fxyj7.png'
  34. import Image4 from '../assets/fxyj8.png'
  35. export default{
  36. data(){
  37. return{
  38. imgList:[
  39. {load:Image1},
  40. {load:Image2},
  41. {load:Image3},
  42. {load:Image4}
  43. ],
  44. titleList:[
  45. {
  46. name:'基础信息',
  47. id:2
  48. },
  49. {
  50. name:'消防管理',
  51. id:3
  52. },
  53. {
  54. name:'风险预警',
  55. id:4
  56. },
  57. ],
  58. titleList1:[
  59. {
  60. name:'警情动态',
  61. id:5
  62. },
  63. {
  64. name:'火灾情况',
  65. id:6
  66. },
  67. {
  68. name:'消防物联网',
  69. id:7
  70. },
  71. ],
  72. test:1,
  73. flag:1
  74. }
  75. },
  76. mounted(){
  77. console.log(this.test);
  78. },
  79. methods:{
  80. ConfirmBtn(num){
  81. this.flag=num
  82. },
  83. getClass(v){
  84. return this.flag==v?'bg-img active':'bg-img'
  85. }
  86. },
  87. created() {
  88. console.log(this)
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. .header{
  94. width: 100%;
  95. height: 120px;
  96. /* background: url('../assets/top.png') center no-repeat; */
  97. background: url('../assets/top.png') center no-repeat;
  98. display: flex;
  99. justify-content: space-between;
  100. }
  101. .title-card{
  102. /* width: 400px; */
  103. display: flex;
  104. padding: 40px 20px ;
  105. font-size: 20px;
  106. }
  107. img{
  108. width: 16px;
  109. height: 15px;
  110. }
  111. .tab-list{
  112. width: 100%;
  113. display: flex;
  114. justify-content: space-between;
  115. }
  116. .bg-img{
  117. width: 138px;
  118. height: 48px;
  119. font-size: 18px;
  120. background: url('../assets/btn.png') no-repeat;
  121. background-size: 100% 100%;
  122. text-align: center;
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. padding-left: 10px;
  127. line-height: 49px;
  128. }
  129. .bg-img:hover{
  130. cursor: pointer;
  131. }
  132. /* 选中效果 */
  133. .active{
  134. width: 150px;
  135. height: 48px;
  136. font-size: 18px;
  137. background: url('../assets/active-btn.png') no-repeat !important;
  138. background-size: 100% 100%;
  139. text-align: center;
  140. line-height: 49px;
  141. }
  142. </style>