npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-carousel-card

v2.0.0

Published

vue轮播卡片组件(vue carousel card component)with [email protected]

Downloads

258

Readme

vue-carousel-card

npm package

❗ vue轮播卡片组件(vue carousel card component),2.x版本为[email protected]组件

❗ 如需在[email protected]中使用,请使用 vue-carousel-card@1.0.7,Github v1.x地址 github 1.x
yarn add vue-carousel-card@^1.0.7
npm i vue-carousel-card@^1.0.7 -S

示例

demo展示

vue-carousel-card vue-carousel-card

用法

# 安装依赖
yarn add vue-carousel-card
# or
npm i vue-carousel-card -S

引入依赖,SPA,非SSR

// 样式需要单独引入
import { defineComponent } from 'vue'
import { CarouselCard, CarouselCardItem } from 'vue-carousel-card'
import 'vue-carousel-card/styles/index.css'

export default defineComponent({
  // 注册组件
  components: { CarouselCard, CarouselCardItem }
})

// 全局引入
import CarouselCard from 'vue-carousel-card'
import 'vue-carousel-card/styles/index.css'

const app = createApp(App)
app.use(CarouselCard)
app.mount('#app')

引入依赖,服务端渲染(SSR)中使用,以Nuxtjs为例

// TODO
// 后期测试后再进行补充
<!-- 使用组件 -->
<template>
  <CarouselCard ref="carouselCardRef" :interval="7000" :autoplay="false" height="260px" type="card" arrow="always" @change="changeHandle">
    <CarouselCardItem v-for="i in 6" :key="i" :name="`cc_${i}`">
      <h1 v-text="i"></h1>
    </CarouselCardItem>
  </CarouselCard>
  <div style="text-align: center; padding: 10px">
    <button @click="prev">prev</button>
    <button @click="next">next</button>
    <button @click="setToFirst">set to first</button>
  </div>
  <CarouselCard :interval="3000" height="300px" :autoplay="false" arrow="always" direction="vertical">
    <CarouselCardItem v-for="i in 6" :key="i">
      <h1 v-text="i"></h1>
    </CarouselCardItem>
  </CarouselCard>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
import { ICarouselCard } from 'vue-carousel-card'

export default defineComponent({
  setup () {
    const carouselCardRef = ref<ICarouselCard>()
    const changeHandle = (index: number) => {
      console.log(index)
    }
    const next = () => {
      carouselCardRef.value?.next()
    }
    const prev = () => {
      carouselCardRef.value?.prev()
    }
    const setToFirst = () => {
      carouselCardRef.value?.setActiveItem(0)
    }
    return {
      carouselCardRef,
      changeHandle,
      next,
      prev,
      setToFirst
    }
  }
})
</script>
/* 示例样式 */
h1 {
  height: 100%;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #FFF;
  background: linear-gradient(90deg, rgba(88,140,236,1), rgba(106,106,207,1))
}

参数

CarouselCard Attributes

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | :----------------- | :---------------------------------- | :------ | :----------------- | :----- | | height | 走马灯的高度 | string | — | — | | initial-index | 初始状态激活的幻灯片的索引,从 0 开始 | number | — | 0 | | trigger | 指示器的触发方式 | string | click | — | | autoplay | 是否自动切换 | boolean | — | true | | interval | 自动切换的时间间隔,单位为毫秒 | number | — | 3000 | | indicator-position | 指示器的位置 | string | outside/none | — | | arrow | 切换箭头的显示时机 | string | always/hover/never | hover | | type | 走马灯的类型 | string | card | — | | loop | 是否循环显示 | boolean | - | true | | direction | 展示的方向 | boolean | horizontal/vertical | horizontal | | pause-on-hover | 鼠标悬浮时暂停自动切换 | boolean | - | true |

CarouselCard Events

| 事件名称 | 说明 | 回调参数 | | :------- | :-------------- | :------------------------------------ | | change | 幻灯片切换时触发 | 目前激活的幻灯片的索引,原幻灯片的索引 |

CarouselCard Methods

| 方法名 | 说明 | 参数 | | :------------ | :----------------- | :------------------------------------------------------------------------ | | setActiveItem | 手动切换幻灯片 | 需要切换的幻灯片的索引,从 0 开始;或相应 carousel-card-item 的 name 属性值 | | prev | 切换至上一张幻灯片 | — | | next | 切换至下一张幻灯片 | — |

CarouselCardItem Attributes

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | :---- | :---------------------------------------- | :----- | :----- | :----- | | name | 幻灯片的名字,可用作 setActiveItem 的参数 | string | — | — | | label | 该幻灯片所对应指示器的文本 | string | — | — |