index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class='tab4'>
  3. <div class="conten">
  4. <div class="left">
  5. <ul>
  6. <li
  7. :class="{ active: imgListInd===item.url }"
  8. v-for="item in imgList"
  9. :key="item.id"
  10. @click="cutTab(item.url)"
  11. >
  12. <p v-if="imgListInd===item.url">
  13. ★&nbsp;{{ item.name }}&nbsp;★
  14. </p>
  15. <p v-else>{{ item.name }}</p>
  16. <span> {{ item.biaoshi }} </span>
  17. </li>
  18. </ul>
  19. </div>
  20. <!-- 动态组件 -->
  21. <keep-alive>
  22. <component :is="imgListInd"></component>
  23. </keep-alive>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import tab4one from './tab4-1.vue'
  29. import tab4tow from './tab4-2.vue'
  30. import tab4three from './tab4-3.vue'
  31. import tab4four from './tab4-4.vue'
  32. import tab4five from './tab4-5.vue'
  33. export default {
  34. name: 'tab4',
  35. components: {tab4one,tab4tow,tab4three,tab4four,tab4five},
  36. data () {
  37. // 这里存放数据
  38. return {
  39. imgListInd: 'tab4one',
  40. imgList: [
  41. { id: 1, name: '学校宣传片', url: 'tab4one',biaoshi:'/' },
  42. { id: 2, name: '美丽校园', url: 'tab4tow' ,biaoshi:'/'},
  43. { id: 3, name: '军歌嘹亮', url: 'tab4three',biaoshi:'/' },
  44. { id: 4, name: '历任学校领导', url: 'tab4four',biaoshi:'/' },
  45. { id: 5, name: '学籍查询', url: 'tab4five' }
  46. ]
  47. }
  48. },
  49. // 监听属性 类似于data概念
  50. computed: {},
  51. // 监控data中的数据变化
  52. watch: {},
  53. // 方法集合
  54. methods: {
  55. // 点击顶部的tab栏切换
  56. cutTab (val) {
  57. this.imgListInd = val
  58. }
  59. },
  60. // 生命周期 - 创建完成(可以访问当前this实例)
  61. created () {
  62. },
  63. // 生命周期 - 挂载完成(可以访问DOM元素)
  64. mounted () {
  65. },
  66. beforeCreate () {}, // 生命周期 - 创建之前
  67. beforeMount () {}, // 生命周期 - 挂载之前
  68. beforeUpdate () {}, // 生命周期 - 更新之前
  69. updated () {}, // 生命周期 - 更新之后
  70. beforeDestroy () {}, // 生命周期 - 销毁之前
  71. destroyed () {}, // 生命周期 - 销毁完成
  72. activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
  73. }
  74. </script>
  75. <style lang='less' scoped>
  76. .tab4{
  77. height: 100%;
  78. .conten{
  79. height: 100%;
  80. min-width: 1740px;
  81. .left {
  82. position: relative;
  83. width: 100%;
  84. height: 180px;
  85. background: url("../../assets/img/tab4Tab.png");
  86. background-size: 100% 100%;
  87. ul {
  88. padding-left: 40px;
  89. display: flex;
  90. height: 100%;
  91. align-items: center;
  92. justify-content: center;
  93. li {
  94. display: flex;
  95. justify-content: center;
  96. font-size: 20px;
  97. color: #fff;
  98. width: 240px;
  99. cursor: pointer;
  100. &:hover {
  101. color: #f2cd83;
  102. }
  103. & > span {
  104. margin-left: 50px;
  105. color: #fff !important;
  106. }
  107. & > p {
  108. text-align: center;
  109. width: 145px;
  110. }
  111. &:nth-of-type(4){
  112. &>p{
  113. width: 165px;
  114. }
  115. }
  116. }
  117. .active {
  118. color: #f2cd83;
  119. }
  120. }
  121. }
  122. .con_tab{
  123. height: 700px;
  124. }
  125. .con_tab1{
  126. display: flex;
  127. justify-content: center;
  128. video{
  129. // width: 100%;
  130. height: 100%;
  131. }
  132. }
  133. }
  134. }
  135. </style>