Volunteer.vue 3.5 KB

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