![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
vue-carousel-card
Advanced tools
vue轮播卡片组件(vue carousel card component)
# 安装依赖
yarn add vue-carousel-card
# or
npm i vue-carousel-card -S
引入依赖,SPA,非SSR
// 样式需要单独引入
import { CarouselCard, CarouselCardItem } from 'vue-carousel-card'
import 'vue-carousel-card/styles/index.css'
export default {
// 注册组件
components: { CarouselCard, CarouselCardItem }
}
引入依赖,服务端渲染(SSR)中使用,以Nuxtjs为例
// @/plugins/vue-carousel-card.js
import Vue from 'vue'
import {
CarouselCard,
CarouselCardItem
} from 'vue-carousel-card'
import 'vue-carousel-card/styles/index.css'
export default () => {
Vue.component(CarouselCard.name, CarouselCard)
Vue.component(CarouselCardItem.name, CarouselCardItem)
}
// nuxt.config.js
plugins: [
'@/plugins/vue-carousel-card'
]
<!-- 使用组件 -->
<CarouselCard :interval="7000" height="300px" type="card" arrow="always">
<CarouselCardItem v-for="i in 6" :key="i">
<h1 v-text="i"></h1>
</CarouselCardItem>
</CarouselCard>
/* 示例样式 */
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))
}
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
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 |
事件名称 | 说明 | 回调参数 |
---|---|---|
change | 幻灯片切换时触发 | 目前激活的幻灯片的索引,原幻灯片的索引 |
方法名 | 说明 | 参数 |
---|---|---|
setActiveItem | 手动切换幻灯片 | 需要切换的幻灯片的索引,从 0 开始;或相应 carousel-card-item 的 name 属性值 |
prev | 切换至上一张幻灯片 | — |
next | 切换至下一张幻灯片 | — |
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
name | 幻灯片的名字,可用作 setActiveItem 的参数 | string | — | — |
label | 该幻灯片所对应指示器的文本 | string | — | — |
1.0.5 (2020-5-8)
FAQs
vue轮播卡片组件(vue carousel card component)with vue@3.x
The npm package vue-carousel-card receives a total of 0 weekly downloads. As such, vue-carousel-card popularity was classified as not popular.
We found that vue-carousel-card demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.