1、安装
yarn add vue3-seamless-scroll
2、导入及基本使用
<!--组件.vue-->
<script setup>
import { Vue3SeamlessScroll } from 'vue3-seamless-scroll';
import {ref} from 'vue'
const listData = ref([
{title:'事件1',content:'内容1'},
{title:'事件2',content:'内容2'},
{title:'事件3',content:'内容3'},
{title:'事件4',content:'内容4'},
])
const isScroll=ref(true)
</script>
<template>
<div class="contain">
<vue3-seamless-scroll
class="scroll"
v-model="isScroll"
:list="listData"
:step="0.3"
:hover="true"
:limit-scroll-num="3"
:wheel="true"
>
<div v-for="item in listData" class="item">
<div class="title">
{{item.title}}:{{item.content}}
</div>
</div>
</vue3-seamless-scroll>
</div>
</template>
<style>
.scroll{
height: 90px;
width: 300px;
overflow: hidden;
}
</style>