el-col、el-row设置自动滚动

用一个div(site-marqee)把要滚动的列表包裹起来,然后在样式中加上: 

animation: row 10s linear infinite;

下面这个是列表滚动的关键:  

@keyframes row {
  0% {
  }
  100% {
    transform: translateY(-50%);
  }
}

 

 html代码: 

        <div class="site-list">
          <div class="site-marqee">
            <el-row
              class="site-item"
              v-for="(item, index) in pressureData"
              :key="index"
            >
              <el-col :span="6" class="item-column">{{ item.name }}</el-col>
              <el-col :span="8" class="item-column">{{ item.code }}</el-col>
              <el-col :span="8" class="item-column">{{ item.pressure }}</el-col>
              <el-col :span="2" class="item-column">{{ item.time }}</el-col>
            </el-row>
          </div>
        </div>

 style代码:

@keyframes row {
  0% {
  }
  100% {
    transform: translateY(-50%);
  }
}
.site-list {
  height: 3.5vw;
  overflow-y: hidden;
  width: 100%;
}
.site-marqee {
  animation: row 10s linear infinite;
}
.site-marqee:hover {
  animation-play-state: paused;
}
.site-item {
  padding: 0.2vw 1.8vw 0.2vw 1.4vw;
  height: 1.2vw;
  display: flex;
  align-content: center;
  align-items: center;
  font-family: "Times New Roman";
}
.site-item:hover {
  background: rgba(255, 255, 255, 0.1);
  .item-column {
    color: #68d8fe;
  }
}
.item-column {
  font-size: 0.7vw;
  color: #61a8ff;
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值