vue3-scroll-seamless一个简单的基于vue3.js的无缝滚动

本文介绍了如何在Vue3项目中使用vue3-scroll-seamless插件来实现类似跑马灯效果的无缝滚动列表,提供了代码示例和官方文档链接以帮助开发者配置参数。
摘要由CSDN通过智能技术生成

  最近有需求  要实现类似于跑马灯效果的图   话不多说  上插件

npm install vue3-scroll-seamless --save
<template>
  <div class="demo">
    <vue3ScrollSeamless
      class="scroll-wrap"
      :classOptions="classOptions"
      :dataList="list"
    >
      <ul class="ui-wrap">
        <li class="li-item" v-for="(item, i) of list" :key="i">
          <div class="img">
            <img :src="item.src" alt="" />

            <div class="day">
              {{ item.day }}
            </div>
          </div>
          <div class="text">
            {{ item.name }}
          </div>
        </li>
      </ul>
    </vue3ScrollSeamless>
  </div>
</template>

<script setup>
import { reactive, ref } from "vue";
import { vue3ScrollSeamless } from "vue3-scroll-seamless";
const props = defineProps(["list"]);
const list = ref(props.list);
console.log(list, "list");
const classOptions = {
  limitMoveNum: 2,
  direction: 2,
  step: 1,
};
</script>

<style scoped lang="scss">
.demo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.scroll-wrap {
  width: 830px;
  height: 256px;

  overflow: hidden;
}
.ui-wrap {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.li-item {
  padding: 17px;
  margin-top: 0;
  margin-left: 12px;
  width: 196px;
  height: 250px;
  text-align: center;
  font-size: 28px;
  box-sizing: border-box;

  flex-direction: column;
  background: #ffffff;
  border-radius: 12px 12px 12px 12px;
  @include displayFlex;
  .img {
    position: relative;
    width: 161px;
    height: 161px;
    background: #ebffdf;
    border-radius: 12px 12px 12px 12px;
    border: 3px solid #a8f6aa;
    .day {
      position: absolute;
      width: 86px;
      height: 46px;
      background: #a8f6aa;
      border-radius: 35px 0px 12px 0px;
      right: 0;
      bottom: 0;
    }
  }
  img {
    width: 161px;
    height: 161px;
    background: #ebffdf;
  }
  .text {
    height: 49px;
    font-weight: 400;
    font-size: 30px;
    color: #3b8c0b;
    line-height: 41px;
    margin-top: 12px;
    font-weight: 400;
    font-size: 31px;

    @include displayFlex;
  }
}
</style>

官方文档  在下边  有些参数自己看配置就好
安装 | vue3-scroll-seamless (xiaofulzm.github.io)

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值