Skip to content
On this page

单步停顿

示例

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
vue
<script lang="ts" setup>
import vueScrollComponents from "vue-scroll-components";
import { ref } from 'vue'
const options = ref({
    direction: 'left',
    singleStep: 110, // 单步滚动步长
    singleWaitTime: 1000, // 单步停止等待时间
})
</script>

<template>
  <vueScrollComponents :options="options" class="wrap">
        <ul>
            <li v-for="index in 8" :key="index" class="item">
                {{ index }}
            </li>
        </ul>
    </vueScrollComponents>
</template>

<style scoped lang="scss">
.wrap {
    width: 600px;
    height: 100px;
    margin: 0 auto;
    overflow: hidden;

    ul {
        list-style: none;
        display: flex;
        margin: 0;
        padding: 0;

        li {
            box-sizing: border-box;
            width: 100px;
            height: 100px;
            background-color: #ccc;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 10px;
        }
    }
}

</style>

欢迎给出一些意见和优化,期待你的 Pull Request.