{"id":18409862,"url":"https://github.com/accforgit/vue-active-preview","last_synced_at":"2025-04-07T09:34:16.194Z","repository":{"id":57394356,"uuid":"163944125","full_name":"accforgit/vue-active-preview","owner":"accforgit","description":":evergreen_tree: A PhotoSwipe Image Preview component for Vue","archived":false,"fork":false,"pushed_at":"2019-02-28T14:44:11.000Z","size":715,"stargazers_count":22,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-31T17:52:53.114Z","etag":null,"topics":["component","preview","previewimage","vue"],"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":"2019-01-03T08:24:23.000Z","updated_at":"2021-10-08T10:56:39.000Z","dependencies_parsed_at":"2022-09-10T00:23:34.783Z","dependency_job_id":null,"html_url":"https://github.com/accforgit/vue-active-preview","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accforgit%2Fvue-active-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/accforgit","download_url":"https://codeload.github.com/accforgit/vue-active-preview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223276809,"owners_count":17118413,"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":["component","preview","previewimage","vue"],"created_at":"2024-11-06T03:27:41.824Z","updated_at":"2024-11-06T03:27:42.747Z","avatar_url":"https://github.com/accforgit.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-active-preview\n\n![NPM](https://nodei.co/npm/vue-active-preview.png?downloads=true\u0026downloadRank=true\u0026stars=true)\n\n![img](https://img.shields.io/npm/v/vue-active-preview.svg) ![img](https://img.shields.io/bundlephobia/minzip/vue-active-preview.svg) ![img](https://img.shields.io/npm/dt/vue-active-preview.svg) ![img](https://img.shields.io/github/license/accforgit/vue-active-preview.svg)\n\n`vue-active-preview` 是一个面向移动端、无依赖、轻量级的 `vue`放大预览组件(`image gallery`)\n\n![img](https://raw.githubusercontent.com/accforgit/vue-active-preview/master/public/preview_1.gif)\n\n[English](https://github.com/accforgit/vue-active-preview/blob/master/README_US.md) | 简体中文\n\n## 示例\n\n- [Basic Demo](https://accforgit.github.io/vue-active-preview/basic.html)\n\n![img](https://raw.githubusercontent.com/accforgit/vue-active-preview/master/public/vue-active-preview.png)\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![img](https://raw.githubusercontent.com/accforgit/vue-active-preview/master/public/swiper_preview.png)\n\n## 安装\n\n```\nnpm install vue-active-preview --save\n```\n\n## 导入\n\n### 全局导入\n\n```js\n// 样式引用\nimport 'vue-active-preview/dist/VueActivePreview.css'\n\nimport Vue from 'vue'\nimport VueActivePreview from 'vue-active-preview'\n\nVue.use(VueActivePreview)\n```\n\n### 局部导入\n\n```js\n// 样式引用\nimport 'vue-active-preview/dist/VueActivePreview.css'\n\n// in ES6 modules\nimport VueActivePreview from 'vue-active-preview'\n\n// in CommonJS\nconst VueActivePreview = require('vue-active-preview')\n\nexport default {\n  components: {\n    VueActivePreview\n  }\n}\n```\n\n### script 脚本形式导入\n\n```html\n\u003clink rel=\"stylesheet\" href=\"../node-modules/vue-active-preview/dist/VueActivePreview.css\" charset=\"utf-8\"\u003e\n\u003cscript src=\"../node-modules/vue-active-preview/dist/VueActivePreview.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n```js\nnew Vue({\n  el: '#app',\n  components: {\n    VueActivePreview\n  }\n})\n```\n\n## 用法\n\n在 `Vue`组件实例中使用:\n```html\n\u003cVueActivePreview :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|传入的图片数组|[]|否|\n|backgroundSize|String|图片以何种缩放的形式铺在滑动容器框(`Swiper`)内，取值及效果都与 `CSS background-size`一致 \u003cbr\u003e只有当指定了 urlList 时才有效|contain|否|\n|maxScaleValue|Number|最大放大倍数，如果设置为 0，表示不限制最大放大倍数|5|否|\n|showCounter|Boolean|是否需要默认的计数器|false|否|\n|counterStyle|Object|自定义默认计数器的样式 \u003cbr\u003e只有当 `showCounter`为 `true`时才有效|null|否|\n|startIndex|Number|起始渲染显示的previewItem 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### slot\n\n`VueActivePreview`组件还可以接收一个 `slot`，方便开发者更加自由地定制化组件，但请注意的是，此 `slot`只是作为 `VueActivePreview`组件的一个普通子元素，而不是可缩放预览的图片组件\n\n```html\n\u003cVueActivePreview :urlList=\"urlList\"\u003e\n  \u003cp\u003eslot content\u003c/p\u003e\n\u003c/VueActivePreview\u003e\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccforgit%2Fvue-active-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccforgit%2Fvue-active-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccforgit%2Fvue-active-preview/lists"}