{"id":15019595,"url":"https://github.com/accforgit/vue-active-swiper","last_synced_at":"2026-03-15T21:12:20.457Z","repository":{"id":57394387,"uuid":"163498443","full_name":"accforgit/vue-active-swiper","owner":"accforgit","description":":palm_tree: A Mobile-oriented、No dependencies、Lightweight Swiper component for Vue","archived":false,"fork":false,"pushed_at":"2019-01-11T13:49:27.000Z","size":394,"stargazers_count":34,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T10:14:39.388Z","etag":null,"topics":["carrousel","slider","swiper","swiper-slider","vue","vue-active-swiper","vue-swiper","vue2"],"latest_commit_sha":null,"homepage":"","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/accforgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-29T09:37:17.000Z","updated_at":"2023-10-03T08:13:30.000Z","dependencies_parsed_at":"2022-09-10T03:42:28.508Z","dependency_job_id":null,"html_url":"https://github.com/accforgit/vue-active-swiper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/accforgit/vue-active-swiper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-swiper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-swiper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-swiper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-swiper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/accforgit","download_url":"https://codeload.github.com/accforgit/vue-active-swiper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-swiper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262047987,"owners_count":23250468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carrousel","slider","swiper","swiper-slider","vue","vue-active-swiper","vue-swiper","vue2"],"created_at":"2024-09-24T19:53:44.634Z","updated_at":"2026-03-15T21:12:15.420Z","avatar_url":"https://github.com/accforgit.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-active-swiper\n\n![NPM](https://nodei.co/npm/vue-active-swiper.png?downloads=true\u0026downloadRank=true\u0026stars=true)\n\n![img](https://img.shields.io/npm/v/vue-active-swiper.svg) ![img](https://img.shields.io/bundlephobia/minzip/vue-active-swiper.svg) ![img](https://img.shields.io/npm/dt/vue-active-swiper.svg) ![img](https://img.shields.io/github/license/accforgit/vue-active-swiper.svg)\n\n`vue-active-swiper` 是一个面向移动端、无依赖、轻量级的 `vue`轮播组件\n\n![img](https://raw.githubusercontent.com/accforgit/vue-active-swiper/master/public/swiper-1.gif)\n\n[English](https://github.com/accforgit/vue-active-swiper/blob/master/README_US.md) | 简体中文\n\n## 示例\n\n- [Basic Demo](https://accforgit.github.io/vue-active-swiper/basic.html)\n\n- [vue-active-preview](https://github.com/accforgit/vue-active-preview) 与 [vue-active-swiper](https://github.com/accforgit/vue-active-swiper)结合使用的 [Live Demo](https://accforgit.github.io/vue-active-preview/swiper_preview.html)\n\n## 安装\n\n```\nnpm install vue-active-swiper --save\n```\n\n## 导入\n\n### 全局导入\n\n```js\n// 样式引用\nimport 'vue-active-swiper/dist/VueActiveSwiper.css'\n\nimport Vue from 'vue'\nimport VueActiveSwiper from 'vue-active-swiper'\n\nVue.use(VueActiveSwiper)\n```\n\n### 局部导入\n\n```js\n// 样式引用\nimport 'vue-active-swiper/dist/VueActiveSwiper.css'\n\n// in ES6 modules\nimport { Swiper, SwiperItem } from 'vue-active-swiper'\n\n// in CommonJS\nconst { Swiper, SwiperItem } = require('vue-active-swiper')\n\nexport default {\n  components: {\n    Swiper,\n    SwiperItem\n  }\n}\n```\n\n### script 脚本形式导入\n\n```html\n\u003clink rel=\"stylesheet\" href=\"../node-modules/vue-active-swiper/dist/VueActiveSwiper.css\" charset=\"utf-8\"\u003e\n\u003cscript src=\"../node-modules/vue-active-swiper/dist/VueActiveSwiper.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n```js\nconst Swiper = VueActiveSwiper.Swiper\nconst SwiperItem = VueActiveSwiper.SwiperItem\n\nnew Vue({\n  el: '#app',\n  components: {\n    Swiper,\n    SwiperItem\n  }\n})\n```\n\n## 用法\n\n在 `Vue`组件实例中使用:\n```html\n\u003cSwiper\u003e\n  \u003cSwiperItem\u003e1\u003c/SwiperItem\u003e\n  \u003cSwiperItem\u003e2\u003c/SwiperItem\u003e\n  \u003cSwiperItem\u003e3\u003c/SwiperItem\u003e\n\u003c/Swiper\u003e\n```\n`or`\n```html\n\u003cSwiper :urlList=\"[\n  'https://dummyimage.com/375x100/FB8A80?text=1',\n  'https://dummyimage.com/375x100/29A90F?text=2',\n  'https://dummyimage.com/375x100/6F9DFF?text=3'\n]\" /\u003e\n```\n\n## Options\n\n### Props\n\n|参数|类型|描述|默认值|是否必须|\n|----|---|----|----|---|\n|urlList|Array|传入的图片数组 \u003cbr\u003e如果指定了此值，则 `Swiper`组件传入的 `SwiperItem`子组件将不起作用，\u003cbr\u003e`urlList` 与 `SwiperItem`二选一，如果二者同时存在，优先以 `urlList`为准|null|否|\n|backgroundSize|String|图片以何种缩放的形式铺在滑动容器框(`Swiper`)内，取值及效果都与 `CSS background-size`一致 \u003cbr\u003e只有当指定了 urlList 时才有效|cover|否|\n|clientW|Number|滑动容器框(`Swiper`)的宽度|`document.documentElement.clientWidth`|否|\n|clientH|Number|滑动容器框(`Swiper`)的宽度|200|否|\n|showCounter|Boolean|是否需要默认的计数器|false|否|\n|counterStyle|Object|自定义默认计数器的样式 \u003cbr\u003e只有当 `showCounter`为 `true`时才有效|null|否|\n|startIndex|Number|起始渲染显示的SwiperItem index|0|否|\n|criticalValue|Number|临界点的比例值，当超过此值代表的临界点，则将自动滑动到下一张图片|1/3|否|\n|autoPlayDelay|Number|如果指定了此参数，并且值 `\u003e= 0`，则将会将此值当做 自动轮播`delay`的时间(单位为 `ms`)进行自动轮播；不指定则不自动轮播 \u003cbr\u003e如果想要指定此值，一般建议设置为 `3000`|null|否|\n|duration|Number|自动滚动到稳定位置所需的时间，单位是秒(ms)|350|否|\n|noDragWhenSingle|Boolean|如果只有一个 swipeItem，是否禁止拖动|true|否|\n\n### Events\n\n|事件名|描述|参数|\n|---|---|---|\n|click|整个组件的点击事件（可用于控制组件的显示/隐藏）|activeIndex|\n|change|每次滚动结束后的回调|activeIndex|\n\n## 额外的能力\n\n### goto\n\n`Swiper`组件提供了一个 `goto`方法，允许使用者自行指定滑动到哪一个 `SwiperItem`的位置：\n\n```js\nthis.$refs.mySwiper.goto(2)\n```\n`goto`方法接收一个 `number`类型的参数(`index`)，表示将要滑动到的 `SwiperItem`的位置\n参数 `index`从 `0` 开始\n\n具体参见示例 [example - basic-slot](https://github.com/accforgit/vue-active-swiper/blob/master/example/basic-slot.vue)\n\n### 具名 slot\n\n`Swiper`组件还可以接收一个 `name`为 `extra`的具名 `slot`，方便开发者更加自由地定制化组件:\n\n```html\n\u003cSwiper\u003e\n  \u003cSwiperItem\u003e1\u003c/SwiperItem\u003e\n  \u003cSwiperItem\u003e2\u003c/SwiperItem\u003e\n  \u003cSwiperItem\u003e3\u003c/SwiperItem\u003e\n  \u003c!-- 具名 slot --\u003e\n  \u003cp slot=\"extra\"\u003ecustom extra content\u003c/p\u003e\n\u003c/Swiper\u003e\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccforgit%2Fvue-active-swiper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccforgit%2Fvue-active-swiper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccforgit%2Fvue-active-swiper/lists"}