【vue2】vue2 实现手风琴效果,复制粘贴直接使用

简介: 【vue2】vue2 实现手风琴效果,复制粘贴直接使用

【vue2】vue2 实现手风琴效果,复制粘贴直接使用

效果

代码

<template>
  <div
    class="about-index"
    :style="{ backgroundImage: 'url(' + lisData.img + ')' }"
  >
    <div class="container">
      <div class="fine-grained">
        <h1>高山流水遇知音</h1>
        <div class="content">
          <!-- 左边 -->
          <div class="left">
            <div class="or-container">
              <div
                class="box"
                :class="eleindex == i ? 'eleactive' : ''"
                v-for="(ele, i) in piclist"
                :key="i"
                @mouseenter="enter(i, ele)"
                @mouseleave="out(i)"
                @click="ounds(ele)"
              >
                <img :src="ele.img" />
                <div class="wenb">
                  <div>{{ ele.title }}</div>
                  <div>{{ ele.name }}</div>
                </div>
              </div>
            </div>
          </div>

          <!-- 右边 -->
          <div class="right">
            <p>{{ lisData.title }}:</p>
            <div>
              {{ lisData.describe }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "index",
  data() {
    return {
      eleindex: 0,
      piclist: [
        {
          title: "看山",
          describe: "青山看不厌,流水趣何长",
          img: "https://img-qn.51miz.com/preview/photo/00/01/51/26/new-P-1512602-6C1160D0O.jpg!/quality/90/unsharp/true/compress/true/fwfh/640x420",
        },
        {
          title: "看水",
          describe: "花香莹把往日情勾起 我愿意化浮萍躺湖心",
          img: "https://img-qn.51miz.com/preview/photo/00/01/51/46/new-P-1514606-AED53C34O.jpg!/quality/90/unsharp/true/compress/true/fwfh/800x800",
        },
        {
          title: "看风景",
          describe: "千里莺啼绿映红,水村山郭酒旗风",
          img: "https://img-qn.51miz.com/2017/06/29/21/2017062921665894_P1247958_238470d3O.jpg!/quality/90/unsharp/true/compress/true/fwfh/640x420",
        },
      ],
      lisData: {
        title: "看山",
        describe: "青山看不厌,流水趣何长",
        img: "https://img-qn.51miz.com/preview/photo/00/01/51/26/new-P-1512602-6C1160D0O.jpg!/quality/90/unsharp/true/compress/true/fwfh/640x420",
      },
    };
  },
  methods: {
    enter: function (i, ele) {
      this.eleindex = i;
      this.lisData = ele;
    },
    out: function (i) {
      this.imgindex = -1;
    },
    ounds(ele) {
      console.log(ele);
    },
  },
  created() {},
};
</script>
 
<style scoped>
.about-index {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
}
.container {
  width: 1200px;
  height: auto;
  margin: 0 auto;
}
/*手风琴样式*/
.or-container {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  height: 100%;
}

.or-container:before {
  background-color: rgba(0, 0, 0, 0.4);
}

.box {
  flex: 1;
  overflow: hidden;
  transition: 0.5s;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
  line-height: 0;
  border-radius: 5px;
  margin: 0px 2px;
  position: relative;
}

.box > img {
  width: 100%;
  height: calc(100%);
  -o-object-fit: cover;
  object-fit: cover;
  transition: 0.5s;
  border-radius: 5px;
  margin: 0px 2px;
  position: relative;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(25, 23, 19, 0) 0%, #613321 100%);
}

.wenb {
  position: absolute;
  left: 0px;
  bottom: 0px;
  color: #fff;
  padding: 5px 15px;
  border-radius: 10px;
}

.wenb div:nth-child(1) {
  width: 80px;
  height: 25px;
  font-size: 18px;
  font-family: PingFangSC-Semibold, PingFang SC;
  font-weight: 600;
  color: #ffffff;
  line-height: 25px;
}

.wenb div:nth-child(2) {
  width: 50px;
  height: 25px;
  font-size: 16px;
  font-family: PingFangSC-Semibold, PingFang SC;
  /* font-weight: 600; */
  color: #ffffff;
  line-height: 25px;
}

.eleactive {
  flex: 1 1 22%;
}

.eleactive > img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

/*end*/

.about-index .content {
  padding: 24px 0px 10px 0px;
  font-size: 16px;
  font-family: SourceHanSerifSC-Regular, SourceHanSerifSC;
  font-weight: 400;
  color: #333333;
  line-height: 30px;
  display: flex;
}

.about-index .content .leftd {
  width: 500px;
  height: 298px;
  /* background-color: pink; */
  overflow: hidden;
}

.about-index .fine-grained .content {
  /* background: #f2e6d1; */
  display: flex;
  justify-content: space-between;
}

.fine-grained .content .left {
  width: 44%;
  /* height: 189px; */
  /* background-color: pink; */
}

.fine-grained .content .right {
  width: 760px;
  height: 450px;
  background: #f2e5d1;
  border-radius: 10px;
  padding: 20px;
}

.fine-grained .content .right p {
  margin: 0px 0px 10px 0px;
  width: 80px;
  height: 22px;
  font-size: 16px;
  font-family: PingFangSC-Semibold, PingFang SC;
  font-weight: 600;
  color: #333333;
  text-align: left;
  line-height: 22px;
}

.fine-grained .content .right div {
  width: 700px;
  /* height: 256px; */
  font-size: 16px;
  font-family: PingFangSC-Semibold, PingFang SC;
  /* font-weight: 600; */
  color: #333333;
  line-height: 32px;
  text-indent: 28px;
  text-align: left;
}

/* .about-index .introduction .content {
  background: #f2e6d1;
} */
</style>
目录
相关文章
|
前端开发
开发过程中遇到过的docx、pptx、xlsx、pdf文件预览多种方式
开发过程中遇到过的docx、pptx、xlsx、pdf文件预览多种方式
497 0
|
网络协议 Go
curl --resolve参数的作用
curl --resolve参数的作用
1219 0
|
存储 前端开发 小程序
《Discuz! X3.5开发从入门到生态共建》系列教程大纲优雅草卓伊凡
《Discuz! X3.5开发从入门到生态共建》系列教程大纲优雅草卓伊凡
370 7
《Discuz! X3.5开发从入门到生态共建》系列教程大纲优雅草卓伊凡
|
人工智能 测试技术 API
PaperBench:OpenAI开源AI智能体评测基准,8316节点精准考核复现能力
PaperBench是OpenAI推出的开源评测框架,通过8316个评分节点系统评估AI智能体复现学术论文的能力,涵盖理论理解、代码实现到实验执行全流程。
958 30
PaperBench:OpenAI开源AI智能体评测基准,8316节点精准考核复现能力
|
机器学习/深度学习 人工智能 搜索推荐
AI与体育训练:运动表现分析
【10月更文挑战第31天】本文探讨了AI在体育训练中的应用,特别是在运动表现分析方面。通过数据收集与处理、深度分析与挖掘、实时反馈与调整三个环节,AI为运动员和教练提供了高效、个性化的训练计划和比赛策略,显著提升了训练效率和比赛成绩。未来,AI将在数据隐私、情感理解及跨学科合作等方面继续发展,为体育事业带来更多可能性。
1595 1
|
前端开发 对象存储
基于RuoYi-Flowable-Plus的ruoyi-nbcio项目的formdesigner文件上传与回显处理
基于RuoYi-Flowable-Plus的ruoyi-nbcio项目的formdesigner文件上传与回显处理
416 0
|
JSON JavaScript 数据格式
打印插件 hiprint 使用、回单打印PDF保存本地、将列表数据打印成pdf文件保存到本地
这篇文章介绍了如何使用hiprint打印插件将列表数据打印成PDF文件并保存到本地,包括插件的配置、依赖安装、项目代码案例以及如何预览和打印数据。
打印插件 hiprint 使用、回单打印PDF保存本地、将列表数据打印成pdf文件保存到本地
|
Linux Android开发 C语言
不写一行代码(一):实现安卓基于GPIO的LED设备驱动
本文通过实践操作,展示了在Android系统中不编写任何代码,利用设备树(DTS)配置和内核支持的通用GPIO LED驱动来控制LED设备,并进一步通过C语言编写NDK测试APP来实现LED的闪烁效果。
1062 0
不写一行代码(一):实现安卓基于GPIO的LED设备驱动
|
数据采集 机器学习/深度学习 前端开发
反爬虫措施
【8月更文挑战第12天】
2091 3