vue2 el-carousel轮播图和文字一起改变

vue项目的话 安装一下element依赖

复制代码
npm i element-ui -S

在main入口文件引入element包

我在app文件里边去写的

复制代码
<template>
  <div class="w">
    <el-carousel height="460px">
        <el-carousel-item v-for="item in items" :key="item.id">
          <h3 class="small">
            <img :src="item.url" alt />
            <span>{{item.title}}</span>
          </h3>
          
        </el-carousel-item>
      </el-carousel>
  </div>
</template>
<script>
export default {
  data(){
    return{
        items:[
           {url:require('./assets/200319120534-7-1200.jpg'),title:'妇科咨询',id:0},
           {url:require('./assets/cesium1.jpg'),title:'儿童咨询',id:1},
           {url:require('./assets/u=1604010673,2427861166&fm=253&fmt=auto&app=138&f=JPEG.webp'),title:'中医咨询',id:2},
        ]
    }
  },
  methods:{
   
   
  },
}
</script>
<style>
  .w {
    margin: 0 auto;
    width: 1226px;
  }
  .el-carousel__item h3 {
    color: #694747;
    font-size: 14px;
    opacity: 1;
    line-height: 300px;
    margin: 0;
    text-align: center;
  }
   .el-carousel__item h3 span{
    /* z-index: 999; */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: orange;
  }

  .small img {
    width: 100%;
    height: 100%;
  }

  /* .el-carousel__container {
    width: 1226px;
    height: 460px;
  } */
</style>
相关推荐
Ai-_Man10 分钟前
从聊天框到正式文档:AI导出鸭瞄准AI大模型应用的“最后一公里”
开发语言·前端·javascript·人工智能·小程序
Q264336502316 分钟前
【有源码】基于Spring Boot+Vue的骑行爱好者平台的设计与实现-计算机毕设选题推荐
java·vue.js·spring boot·毕业设计·课程设计·数据可视化·源代码
FYKJ_201020 分钟前
SpringSecurity教室智能预约系统73972-计算机课程设计、毕业设计
java·vue.js·spring boot·python·mysql·spring·django
专业程序开发源21 分钟前
springboot酒店会员点餐系统22339-计算机课程设计、毕业设计
java·javascript·vue.js·spring boot·后端·php·课程设计
FYKJ_20101 小时前
springboot游泳馆管理系统79222-计算机课程设计、毕业设计
vue.js·spring boot·后端·python·mysql·django·课程设计
现任明教教主~3 小时前
SpringBoot+Vue学生宿舍管理系统源码 带部署文档
vue.js·spring boot·后端
panxianren8 小时前
Bun 1.4 的 bun test --parallel 将 4 秒的测试套件缩短到约 1 秒
java·javascript
可乐鸡翅yeah_11 小时前
FFmpeg 生成 HLS 独立分片 independent‑segments 参数到底有什么用
javascript·ffmpeg·音视频·safari·m3u8
福兮说11 小时前
canvas 旋转图片的六个坑:四角被裁、Math.ceil 多出 1px 黑边、JPG 角发黑、翻转方向反了
前端·javascript·图像处理·canvas
Ai-_Man13 小时前
您您这可以把Grok的多个会话比如说。左侧的多个会话一次性导出吗?不是单条会话里面的多次会对话。AI导出鸭
javascript·人工智能·ai·小程序·电脑