123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <div class="Volunteer">
- <div
- class="row"
- v-for="(item, index) in data"
- :key="item.id"
- @click="skip(item.id)"
- >
- <img :src="`/data/JoinSupport/v${index + 1}.jpg`" alt="" />
- <h1>{{ item.h3 }}</h1>
- <div
- class="y1"
- :style="`background-image:url('/data/JoinSupport/y${index + 1}.png')`"
- ></div>
- <div
- class="d1"
- :style="`background-image:url('/data/JoinSupport/y${index + 1}Ac.png')`"
- ></div>
- </div>
- </div>
- </template>
- <script>
- import { JoinSupport } from "../dataAll";
- export default {
- name: "Volunteer",
- components: {},
- data() {
- //这里存放数据
- return {
- data: [],
- };
- },
- //监听属性 类似于data概念
- computed: {},
- //监控data中的数据变化
- watch: {},
- //方法集合
- methods: {
- // 点击单个进入详情
- skip(id) {
- this.$router.push({
- name: "VolunteerInfo",
- query: { id },
- });
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.data = JoinSupport.Volunteer;
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='less' scoped>
- .Volunteer {
- clear: both;
- width: 1200px;
- height: 627px;
- padding-top: 4px;
- margin: 20px auto 100px;
- background-image: url("/data/JoinSupport/bg3.gif");
- background-repeat: no-repeat;
- background-position: 0 0;
- .row {
- cursor: pointer;
- width: 300px;
- height: 627px;
- float: left;
- position: relative;
- overflow: hidden;
- background-color: #000;
- & > img {
- transition: all 0.5s;
- border: none;
- vertical-align: top;
- opacity: 0.4;
- width: 300px;
- height: 627px;
- }
- & > h1 {
- font-weight: 700;
- width: 300px;
- font-size: 24px;
- color: #fff;
- text-align: center;
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- z-index: 10;
- }
- .y1 {
- width: 74px;
- height: 74px;
- position: absolute;
- left: 50%;
- top: 50%;
- z-index: 1;
- margin: -37px 0 0 -37px;
- }
- .d1 {
- transition: all 0.5s;
- display: block;
- opacity: 0;
- width: 228px;
- height: 228px;
- position: absolute;
- left: 50%;
- top: 50%;
- z-index: 2;
- margin: -114px 0 0 -114px;
- }
- &:hover {
- & > img {
- opacity: 1;
- }
- .d1 {
- opacity: 1;
- }
- }
- }
- }
- </style>
|