{"id":13424090,"url":"https://github.com/ElemeFE/vue-swipe","last_synced_at":"2025-03-15T18:33:48.793Z","repository":{"id":41153126,"uuid":"47816524","full_name":"ElemeFE/vue-swipe","owner":"ElemeFE","description":"A touch slider for vue.js.","archived":false,"fork":false,"pushed_at":"2019-10-15T00:59:50.000Z","size":197,"stargazers_count":928,"open_issues_count":43,"forks_count":285,"subscribers_count":55,"default_branch":"master","last_synced_at":"2024-05-22T13:04:54.426Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElemeFE.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-11T09:12:48.000Z","updated_at":"2024-04-08T12:48:40.000Z","dependencies_parsed_at":"2022-08-27T14:20:52.080Z","dependency_job_id":null,"html_url":"https://github.com/ElemeFE/vue-swipe","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElemeFE%2Fvue-swipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElemeFE%2Fvue-swipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElemeFE%2Fvue-swipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElemeFE%2Fvue-swipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElemeFE","download_url":"https://codeload.github.com/ElemeFE/vue-swipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221601254,"owners_count":16850309,"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":[],"created_at":"2024-07-31T00:00:48.397Z","updated_at":"2024-10-26T23:30:13.348Z","avatar_url":"https://github.com/ElemeFE.png","language":"Vue","funding_links":[],"categories":["Awesome Vue.js [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)","UI组件","Vue","Awesome Vue.js"],"sub_categories":["Libraries \u0026 Plugins"],"readme":"# vue-swipe\n\nvue-swipe is a touch slider for Vue.js.\n\n## Install\n\n```bash\n$ npm install vue-swipe\n```\n\n## Import\n\n### Import using module\n\nImport components to your project:\n\n``` js\nrequire('vue-swipe/dist/vue-swipe.css');\n\n// in ES6 modules\nimport { Swipe, SwipeItem } from 'vue-swipe';\n\n// in CommonJS\nconst { Swipe, SwipeItem } = require('vue-swipe');\n\n// in Global variable\nconst { Swipe, SwipeItem } = VueSwipe;\n```\n\nAnd register components:\n\n``` js\nVue.component('swipe', Swipe);\nVue.component('swipe-item', SwipeItem);\n```\n\n### Import using script tag\n\n``` html\n\u003clink rel=\"stylesheet\" href=\"../node-modules/vue-swipe/dist/vue-swipe.css\" charset=\"utf-8\"\u003e\n\u003cscript src=\"../node-modules/vue-swipe/dist/vue-swipe.js\"\u003e\u003c/script\u003e\n```\n\n``` js\nconst vueSwipe = VueSwipe.Swipe;\nconst vueSwipeItem = VueSwipe.SwipeItem;\n\nnew Vue({\n  el: 'body',\n  components: {\n    'swipe': vueSwipe,\n    'swipe-item': vueSwipeItem\n  }\n});\n```\n\n## Usage\n\nWork on a Vue instance:\n\n```HTML\n\u003cswipe class=\"my-swipe\"\u003e\n  \u003cswipe-item class=\"slide1\"\u003e\u003c/swipe-item\u003e\n  \u003cswipe-item class=\"slide2\"\u003e\u003c/swipe-item\u003e\n  \u003cswipe-item class=\"slide3\"\u003e\u003c/swipe-item\u003e\n\u003c/swipe\u003e\n```\n\n```CSS\n.my-swipe {\n  height: 200px;\n  color: #fff;\n  font-size: 30px;\n  text-align: center;\n}\n\n.slide1 {\n  background-color: #0089dc;\n  color: #fff;\n}\n\n.slide2 {\n  background-color: #ffd705;\n  color: #000;\n}\n\n.slide3 {\n  background-color: #ff2d4b;\n  color: #fff;\n}\n```\n\n## Options\n\n### Props\n\n| Option | Type | Description | Default |\n| ----- | ----- | ----- | ----- |\n| speed | Number | Speed of animation | 300 |\n| defaultIndex | Number | Start swipe item index | 0 |\n| disabled | Boolean | Disable user drag swipe item | false |\n| auto | Number | Delay of auto slide | 3000 |\n| continuous | Boolean | Create an infinite slider without endpoints | true |\n| showIndicators | Boolean | Show indicators on slider bottom | true |\n| noDragWhenSingle | Boolean | Do not drag when there is only one swipe-item | true |\n| prevent | Boolean | `preventDefault` when touch start, useful for some lower version Android Browser (4.2, etc) | false |\n| propagation | Boolean | solve nesting | false |\n| disabled | Boolean | disabled user swipe item | false |\n\n### Events\n\n| Event Name | Description | params |\n| ----- | ----- | ----- |\n| change | triggers when current swipe-item change | new swipe item Index, old swipe item Index |\n\n## FAQ\n\n### How to programminly swipe to an item?\n\nUse ref and call `goto()` method.\n\n``` js\nthis.$refs.swipe.goto(newIndex)\n```\n\nFor more details, please refer to example code.\n\n## Development\n\nWatching with hot-reload:\n\n```bash\n$ npm run dev\n```\n\nDevelop on real remote device:\n\n```bash\n$ npm run remote-dev {{ YOUR IP ADDRESS }}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElemeFE%2Fvue-swipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FElemeFE%2Fvue-swipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElemeFE%2Fvue-swipe/lists"}