Volunteer.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="Volunteer">
  3. <div
  4. class="row"
  5. v-for="(item, index) in data"
  6. :key="item.id"
  7. @click="skip(item.id)"
  8. >
  9. <img :src="`/data/JoinSupport/v${index + 1}.jpg`" alt="" />
  10. <h1>{{ item.h3 }}</h1>
  11. <div
  12. class="y1"
  13. :style="`background-image:url('/data/JoinSupport/y${index + 1}.png')`"
  14. ></div>
  15. <div
  16. class="d1"
  17. :style="`background-image:url('/data/JoinSupport/y${index + 1}Ac.png')`"
  18. ></div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import { JoinSupport } from "../dataAll";
  24. export default {
  25. name: "Volunteer",
  26. components: {},
  27. data() {
  28. //这里存放数据
  29. return {
  30. data: [],
  31. };
  32. },
  33. //监听属性 类似于data概念
  34. computed: {},
  35. //监控data中的数据变化
  36. watch: {},
  37. //方法集合
  38. methods: {
  39. // 点击单个进入详情
  40. skip(id) {
  41. this.$router.push({
  42. name: "VolunteerInfo",
  43. query: { id },
  44. });
  45. },
  46. },
  47. //生命周期 - 创建完成(可以访问当前this实例)
  48. created() {
  49. this.data = JoinSupport.Volunteer;
  50. },
  51. //生命周期 - 挂载完成(可以访问DOM元素)
  52. mounted() {},
  53. beforeCreate() {}, //生命周期 - 创建之前
  54. beforeMount() {}, //生命周期 - 挂载之前
  55. beforeUpdate() {}, //生命周期 - 更新之前
  56. updated() {}, //生命周期 - 更新之后
  57. beforeDestroy() {}, //生命周期 - 销毁之前
  58. destroyed() {}, //生命周期 - 销毁完成
  59. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  60. };
  61. </script>
  62. <style lang='less' scoped>
  63. .Volunteer {
  64. clear: both;
  65. width: 1200px;
  66. height: 627px;
  67. padding-top: 4px;
  68. margin: 20px auto 100px;
  69. background-image: url("/data/JoinSupport/bg3.gif");
  70. background-repeat: no-repeat;
  71. background-position: 0 0;
  72. .row {
  73. cursor: pointer;
  74. width: 300px;
  75. height: 627px;
  76. float: left;
  77. position: relative;
  78. overflow: hidden;
  79. background-color: #000;
  80. & > img {
  81. transition: all 0.5s;
  82. border: none;
  83. vertical-align: top;
  84. opacity: 0.4;
  85. width: 300px;
  86. height: 627px;
  87. }
  88. & > h1 {
  89. font-weight: 700;
  90. width: 300px;
  91. font-size: 24px;
  92. color: #fff;
  93. text-align: center;
  94. position: absolute;
  95. left: 0;
  96. top: 50%;
  97. transform: translateY(-50%);
  98. z-index: 10;
  99. }
  100. .y1 {
  101. width: 74px;
  102. height: 74px;
  103. position: absolute;
  104. left: 50%;
  105. top: 50%;
  106. z-index: 1;
  107. margin: -37px 0 0 -37px;
  108. }
  109. .d1 {
  110. transition: all 0.5s;
  111. display: block;
  112. opacity: 0;
  113. width: 228px;
  114. height: 228px;
  115. position: absolute;
  116. left: 50%;
  117. top: 50%;
  118. z-index: 2;
  119. margin: -114px 0 0 -114px;
  120. }
  121. &:hover {
  122. & > img {
  123. opacity: 1;
  124. }
  125. .d1 {
  126. opacity: 1;
  127. }
  128. }
  129. }
  130. }
  131. </style>