element plus框架中手机左右滑动如何切换Carousel 走马灯的内容,包括AQI等级

1.先给最全的代码 最后详细解释
//HomePage.vue 页面
<template>
    <div class="block text-center" trigger="hover"  style="overflow:  scroll;">
      <el-carousel ref="myRef" height="auto" :autoplay="false" :initial-index="clicknum" @change="chfun">
        <el-carousel-item style=" height: calc(100vh - 112px);min-height: 665px; overflow:  scroll;" v-for="item in items" :key="item">
            <el-row style="color:#FFF; text-align: left;margin-top: 30px;">
                <el-col :span="20"><span style="padding-left: 20px; font-size: 22px;">{
   {
   item.areaName}}  <span style="font-size: 12px;">{
   {
    item.quyudex }}</span> </span></el-col>
                <el-col :span="4"></el-col>
                <el-col :span="12"><span style="padding-left: 20px;font-size: 12px;">空气质量指数/AQI</span></el-col>
            </el-row>
            <el-row style="color:#FFF; text-align: center;margin-top: 10px;">
                <el-col :span="24"><span style="font-size: 38px; font-weight: 600;"  :style="{color:item.AQIcolor}">{
   {
   item.AQI}}</span></el-col>
                <el-col :span="24"><span style="font-size: 26px;font-weight: 600; ">{
   {
   item.name}}</span></el-col>
                <el-col :span="24"><span style="font-size: 18px;">首要污染物:{
   {
   item.CriticalPollutants.replace("PM10","颗粒物(PM₁₀)").replace("PM25","颗粒物(PM₂.₅)").replace("SO2","二氧化硫(SO₂)").replace("CO","一氧化碳(CO)").replace("NO2","二氧化氮(SO₂)").replace("O3_8H","臭氧(O₃)").replace("O3","臭氧(O₃)").replace("_",",")}}</span></el-col>
                <el-col :span="24"><span style="font-size: 14px;">更新时间:{
   {
   item.datetime}}</span></el-col>
            </el-row>

            <el-row class="row-bg" justify="space-evenly" style="color:#FFF;font-size: 14px; margin-top: 10px;">
                <el-col :span="6" style="display: flex; justify-content: center;">
                    <div style="height: 70px; width: 70px; border-radius: 70px; background: rgba(255, 255, 255, 0.4);">
                       <div style="text-align: center;line-height: 34px;"> {
   {
   item.PM25}}</div>
                       <div style="width: 40px;margin-left: 15px;height: 2px;background: #fff;" :style="{background:item.pm25color}"></div>
                       <div style="text-align: center;line-height: 30px;">PM.</div>
                    </div>
                </el-col>
                <el-col :span="6" style="display: flex; justify-content: center;">
                    <div style="height: 70px; width: 70px; border-radius: 70px; background: rgba(255, 255, 255, 0.4);">
                       <div style="text-align: center;line-height: 34px;"> {
   {
   item.PM10}}</div>
                       <div style="width: 40px;margin-left: 15px;height: 2px;background: #fff;" :style="{background:item.pm10color}"></div>
                       <div style="text-align: center;line-height: 30px;">PM₁₀</div>
                    </div>
                </el-col>
                <el-col :span="6" style="display: flex; justify-content: center;">
                    <div style="height: 70px; width: 70px; border-radius: 70px; background: rgba(255, 255, 255, 0.4);">
                       <div style="text-align: center;line-height: 34px;"> {
   {
   item.SO2}}</div>
                       <div style="width: 40px;margin-left: 15px;height: 2px;background: #fff;" :style="{background:item.so2color}"></div>
                       <div style="text-align: center;line-height: 30px;">SO</div>
                    </div>
                </el-col>
            </el-row>
            <el-row class="row-bg" justify="space-evenly" style="color:#FFF;font-size: 14px; margin-top: 20px;">
                <el-col :span="6" style="display: flex; justify-content: center;">
                    <div style="height: 70px; width: 70px; border-radius: 70px; background: rgba(255, 255, 255, 0.4);">
                       <div style="text-align: center;line-height: 34px;"> {
   {
   item.NO2}}</div>
                       <div style="width: 40px;margin-left: 15px;height: 2px;background: #fff;" :style="{background:item.no2color}"></div>
                       <div style="text-align: center;line-height: 30px;">NO</div>
                    </div>
                </el-col>
                <el-col :span="6" style="display: flex; justify-content: center;">
                    <div style="height: 70px; width: 70px; border-radius: 70px; background: rgba(255, 255, 255, 0.4);">
                       <div style="text-align: center;line-height: 34px;"> {
   {
   item.O3}}</div>
                       <div style="width: 40px;margin-left: 15px;height: 2px;background: #fff;" :style="{background:item.o3color}"></div>
                       <div style="text-align: center;line-height: 30px;">O</div>
                    </div>
                </el-col>
                <el-col :span="6" style="display: flex; justify-content: center;">
                    <div style="height: 70px; width: 70px; border-radius: 70px; background: rgba(255, 255, 255, 0.4);">
                       <div style="text-align: center;line-height: 34px;"> {
   {
   item.CO}}</div>
                       <div style="width: 40px;margin-left: 15px;height: 2px;background: #fff;" :style="{background:item.cocolor}"></div>
                       <div style="text-align: center;line-height: 30px;">CO</div>
                    </div>
                </el-col>
            </el-row>

            <el-row style="color:#FFF; text-align: left;margin-top: 10px;">
                <el-col :span="12"><span style="padding-left: 25px;font-size: 14px;">温馨提示:</span></el-col>
            </el-row>
            <el-row style="color:#FFF; text-align: left;margin-top: 10px;">
                <el-col :span="4">
                    <el-image style="padding:2px;box-sizing: border-box;margin-left: 25px; width: 40px; height: 40px;border: 1px solid #FFF ;" :src="pb" :fit="'fill'" />
                </el-col>
                <el-col :span="20" style="padding-left: 25px;font-size: 14px; display: flex; flex-direction: column;justify-content: center; ">{
   {
   item.tishi[0]}}</el-col>

                <el-col :span="4">
                    <el-image style="padding:2px;box-sizing: border-box;margin-left: 25px; width: 40px; height: 40px;border: 1px solid #FFF ;" :src="jr" :fit="'fill'" />
                </el-col>
                <el-col :span="20" style="padding-left: 25px;font-size: 14px;  display: flex; flex-direction: column;justify-content: center;  ">{
   {
   item.tishi[1]}}</el-col>

                <el-col :span="4">
                    <el-image style="padding:2px;box-sizing: border-box;margin-left: 25px; width: 40px; height: 40px;border: 1px solid #FFF ;" :src="mg" :fit="'fill'" />
                </el-col>
                <el-col :span="20" style="padding-left: 25px;font-size: 14px;  display: flex; flex-direction: column;justify-content: center; ">{
   {
   item.tishi[2]}}</el-col>

                <el-col :span="4">
                    <el-image style="padding:2px;box-sizing: border-box;  margin-left: 25px; width: 40px; height: 40px;border: 1px solid #FFF ;" :src="ch" :fit="'fill'" />
                </el-col>
                <el-col :span="20" style="padding-left: 25px;font-size: 14px; display: flex; flex-direction: column;justify-content: center; ">{
   {
   item.tishi[3]}}</el-col>
            </el-row>

        </el-carousel-item>
      </el-carousel>
    </div>
  </template>
  <script lang="ts" setup
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用提到的,使用element-plus的el-carousel组件来放置滚动广告时,可以通过设置type="card"来实现效果。至于走马灯图片的大小,文档并没有具体说明。 根据引用的解决方法,可以为carousel组件添加显示条件list.length > 0,只有当list不为null且长度大于0时才会渲染元素。这意味着走马灯图片的大小可能取决于绑定给el-carousel的数据list的元素数量和大小。 引用提到,el-carousel绑定的数据需要一个初始值。如果初始值为空数组([]),可能会出现异常。所以可以通过为初始值提供一些图片元素,比如var bannerList = ref([1, 2, 3]),来确保开始时就有一些图片展示在走马灯,从而确定走马灯的图片大小。 综上所述,element-plus carousel走马灯的图片大小是由绑定给el-carousel的数据的图片元素数量和大小决定的。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [element-plus 之el-carousel 走马灯 加载图片刚进入的时候为什么数据显示不对?](https://blog.csdn.net/weixin_43136717/article/details/128233256)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Vue3 + Element-Plus carousel走马灯 显示动态数据时 默认会显示一个空白元素](https://blog.csdn.net/qq_40007006/article/details/120440831)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值