Giter Club home page Giter Club logo

vue-carousel's Introduction

Vue Carousel

一个简单、灵活的Vue3走马灯组件,非常轻量,只有5kB

预览地址: https://kagol.gitee.io/vue-carousel/

快速开始

创建一个vite工程:

yarn create vite vite-demo --template vue-ts

安装Carousel

yarn add @kagol/vue-carousel

main.ts中引入Carousel

import Carousel from '@kagol/vue-carousel'
import '@kagol/vue-carousel/dist/style.css'

createApp(App)
.use(Carousel)
.mount('#app')

App.vue中使用:

<DCarousel>
  <div class="carousel-item">page 1</div>
  <div class="carousel-item">page 2</div>
  <div class="carousel-item">page 3</div>
</DCarousel>

效果动图

默认效果:

1-default.gif

掘金活动:

2-juejin.gif

指示器位置:

3-indicator-position.gif

自定义指示器:

4-custom-indicator.gif

分页器位置:

5-pagination-position.gif

自定义分页器:

6-custom-pagination.gif

华为官网:

7-huawei.gif

QQ音乐:

8-qqmusic.gif

B站:

9-bilibili.gif

手风琴式折叠卡片:

10-collapse-card.gif

API

DCarousel 组件

props

属性 类型 默认 说明
v-model Number 1 可选,当前页码
autoplay Boolean true 可选,是否自动播放
interval Number 3000 可选,自动播放的时间间隔,单位是毫秒

插槽

属性 类型 默认 说明
default -- -- 必选,默认插槽
indicator -- -- 可选,指示器插槽
pagination -- -- 可选,分页器插槽

DCarouselIndicator 组件

props

属性 类型 默认 说明
v-model Number 1 可选,当前页码
count Number -- 可选,指示器元素数量

插槽

属性 类型 默认 说明
default ({ pageIndex, setPageIndex }) => {} -- 可选,默认插槽

DCarouselPrev 组件

插槽

属性 类型 默认 说明
default -- -- 可选,默认插槽

DCarouselNext 组件

插槽

属性 类型 默认 说明
default -- -- 可选,默认插槽

参考:

用积木理论设计的Carousel组件都有哪些有趣的玩法?

vue-carousel's People

Contributors

kagol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

yinghualiu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.