
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
v3-carousel
Advanced tools
基于 vue3 composition api 编写的轮播插件,多种属性适配,轮播内容 可完全自定义,基本可以满足大部分的轮播需求。
基本功能介绍:
在线Demo:正在制作...
npm install v3-carousel
or
yarn add v3-carousel
main.js
import { createApp } from "vue";
import App from "./App.vue";
import Carousel from "v3-carousel"; // 引入
const app = createApp(App)
app.use(Carousel).mount('#app') // 使用
注意点:将你需要显示的图片使用
CarouselItem包裹起来(创建CarouselItem暂时必须使用v-for循环完成,因为我需要使用到idx来操作),完成之后你还需要将这些CarouselItem用一个大的Carousel包裹起来,再给Carousel添加你需要的属性,好了,到这里一个实例就完成了,你可以去网页上查看轮播图了
App.vue
<script setup lang="ts">
import { reactive } from 'vue';
const state = reactive({
data: [
"https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00693-2745.jpg",
"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2190440116,1436403087&fm=26&gp=0.jpg",
"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3593656793,3600757928&fm=26&gp=0.jpg",
],
});
function beforeMoving(dir: { index: number, direction: string }) {
// console.log("before", dir);
}
function afterMoving(dir: { index: number, direction: string }) {
// console.log("after", dir);
}
</script>
<template>
<div style="width: 400px; height: 300px">
<Carousel
:autoplay="true"
:duration="2000"
:initIndex="2"
:direction="true"
directionMode="hover"
:directionSize="20"
directionColor="skyblue"
:indicator="true"
indicatorMode="always"
indicatorColor="white"
indicatorActiveColor="skyblue"
@before-moving="beforeMoving"
@after-moving="afterMoving">
<CarouselItem v-for="(item, index) in state.data" :key="index" :idx="index">
<img :src="item" />
</CarouselItem>
</Carousel>
</div>
</template>
| property name | type | default value | meaning |
|---|---|---|---|
| containerWidth | String | 100% | 设置整个carousel容器的宽度,当然你也可以使用vw,rem,em等像素单位 |
| containerHeight | String | 100% | 设置整个carousel容器的g高度,同上 |
| duration | Number | 3000 | 轮播间隔是多久一次 |
| initIndex | Number | 0 | 初始化显示的图片索引 |
| autoplay | Boolean | true | 是否自动开始轮播 |
| direction | Boolean | true | 是否需要切换按钮(即 上、下一张按钮) |
| directionMode | String | always | 切换按钮的展示方式,可选 always、hover |
| directionColor | String | white | 切换按钮的颜色 |
| directionSize | Number | 25 | 切换按钮的大小,单位(px) |
| indicator | Boolean | true | 是否需要轮播图指示器(底部当前选中标识) |
| indicatorMode | String | always | 切换按钮的展示方式,可选 always、hover |
| indicatorColor | String | #FFFFFF80 | 未选中时的指示器颜色 |
| indicatorActiveColor | String | #FFFFFF | 选中时的指示器颜色 |
| event Name | parmas | meaning |
|---|---|---|
| @before-moving | 该钩子函数拥有一个对象参数,你可以获取到它们:轮播的方向(direction)以及当前轮播的索引(index) | 视图移动前会执行的钩子函数,如果您想在轮播图轮播前做一些逻辑可以使用该钩子 |
| @after-moving | 同上... | 视图移动完成后会执行的钩子函数,如果您想在轮播图轮播完成之后做一些逻辑可以使用该钩子 |
| property name | type | default value | meaning |
|---|---|---|---|
| idx | Number | 0 | 每个子实例对应的索引,一般用 v-for 中的第二个参数即可 |
使用如果出现问题欢迎来讨论,觉得好用的话就点个
star吧,o( ̄▽ ̄)o有什么建议欢迎大佬们提交
pr,谢谢!
FAQs
基于vue3的轮播图插件,多种属性适配,可以满足基本需求。
The npm package v3-carousel receives a total of 10 weekly downloads. As such, v3-carousel popularity was classified as not popular.
We found that v3-carousel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.