{"_id":"@adolph_dudu/vue-aspect-ratio-swiper","name":"@adolph_dudu/vue-aspect-ratio-swiper","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@adolph_dudu/vue-aspect-ratio-swiper","description":"aspect-ratio-swiper component for Vue. updated from vue-awesome-swiper","version":"0.0.1","keywords":["vue swiper","vue aspect ratio swiper","vue carrousel","carrousel","swiper"],"license":"MIT","private":false,"repository":{"type":"git","url":"git+https://github.com/Adophlidu/vue-awesome-swiper.git"},"homepage":"https://github.com/Adophlidu/vue-awesome-swiper","author":{"name":"Adolph","url":"https://github.com/Adophlidu"},"main":"dist/vue-awesome-swiper.js","module":"dist/vue-awesome-swiper.esm.js","browser":"dist/vue-awesome-swiper.js","jsdelivr":"dist/vue-awesome-swiper.js","unpkg":"dist/vue-awesome-swiper.js","jspm":{"main":"dist/vue-awesome-swiper.esm.js","registry":"npm","format":"esm"},"types":"dist/index.d.ts","scripts":{"cleanup":"rm -rf ./dist/*","build":"npm run cleanup && cross-env NODE_ENV=production abc build","lint":"abc lint --ext .ts,.vue src tests","test":"abc test","test:watch":"abc test --watch -i","rebirth":"npm run lint && npm test && npm run build","release":". ./scripts/release.sh"},"peerDependencies":{"swiper":"npm:@adolph_dudu/ratio-swiper@0.0.1","vue":"2.x"},"devDependencies":{"@surmon-china/abc-factory":"^0.3.3","@types/swiper":"^5.2.1","cross-env":"^6.0.3","swiper":"npm:@adolph_dudu/ratio-swiper@0.0.1","typescript":"^3.7.5","vue":"^2.6.10"},"engines":{"node":">=8"},"gitHead":"1c704727a44a8593cb5de3517c57e2bb8049138a","bugs":{"url":"https://github.com/Adophlidu/vue-awesome-swiper/issues"},"_id":"@adolph_dudu/vue-aspect-ratio-swiper@0.0.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-mYYJ/Dn0xlyZcDEaknO4A9IL4WnT66WY2q2mYE0lHGj110bmhfHTVCcJFepA3lIwdeeoTfGHEhuQe3MPwQj3BQ==","shasum":"300b7dd843a7b9122745b697a394be61d0116b8c","tarball":"https://registry.npmjs.org/@adolph_dudu/vue-aspect-ratio-swiper/-/vue-aspect-ratio-swiper-0.0.1.tgz","fileCount":11,"unpackedSize":28337,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICHzHCU+omC8CaufCMwhrqmx0SqdCjej1Pc2UBGtTbDUAiAcG43rCIAJiFl6yXgkHZdqWBTYE3hYR8sSynqXXsh2jg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi6JREACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpdIQ/+JPtK977af1CuJwvC1ytzNdeI/zJarNpAlgktmxhuprcfWy4W\r\nAxqDaUzthCwNvp0dSBnO2acctBN0QculwRiuBjaJBIpORqBoJhbLL2FS3TN8\r\n8EUocs51Wpd5JrfyH7xvWggYr/XvZnJ9TRj1WR4t4jM++taCkn/tH9yxlZC6\r\nknbJ90EB4e13xrL5R81domUBb/9FMoqca6jP+0WAXxKJ7mnXD0UJu1TrN62l\r\nzLW7UnyA5yII3Wz5QrKS7IIuLtuGv/WpuwvaU+qe8MFEhpe6zBkcNlh/vrgt\r\nrHJon6cmHX52zb9plxIfhxUhjjdg2dCRsh3EISfPpg/JbTzZN/1hzAzbCnIX\r\ny/bdQ0F9Cx2mk3I0AuRMDpG7qMaD470h8uUVsSKEY5kZmFOhkle3lfVlkf1z\r\n31XxNaLUDonq6B5O95N+jy60F9LU1J6Q9+fBOILlej46SR7xQyT198hL5pZH\r\nuyY42H8ooDKHYlBeYdD5vbGfQmL7354gPS4lBm32sFQStFkPjxLYGwu6A9dh\r\nmOhtmll9PvD2spAEpBhe5nh1GwhHaVzXSQrTYMMflqBLYdc0yUCjUrewAkNJ\r\nFSuKYB0lprqUQLb4udz4aK2FU3BUJXGKD9EDpywMd3VYgWgVOEr1ipdMle4r\r\nUyp8HYNGqE5714jIwP+pocCYmGJWdBJ1IvE=\r\n=y3B3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"adolph_dudu","email":"2838749374@qq.com"},"directories":{},"maintainers":[{"name":"adolph_dudu","email":"2838749374@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vue-aspect-ratio-swiper_0.0.1_1659409476049_0.825550468529548"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-02T03:04:36.004Z","0.0.1":"2022-08-02T03:04:36.224Z","modified":"2022-08-02T03:04:36.338Z"},"maintainers":[{"name":"adolph_dudu","email":"2838749374@qq.com"}],"description":"aspect-ratio-swiper component for Vue. updated from vue-awesome-swiper","homepage":"https://github.com/Adophlidu/vue-awesome-swiper","keywords":["vue swiper","vue aspect ratio swiper","vue carrousel","carrousel","swiper"],"repository":{"type":"git","url":"git+https://github.com/Adophlidu/vue-awesome-swiper.git"},"author":{"name":"Adolph","url":"https://github.com/Adophlidu"},"bugs":{"url":"https://github.com/Adophlidu/vue-awesome-swiper/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <a href=\"https://swiperjs.com\" target=\"_blank\">\n    <img width=\"77px\" src=\"https://github.surmon.me/images/common/swiper-logo.svg\" />\n  </a>\n  <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>\n  <a href=\"https://vuejs.org\" target=\"_blank\">\n    <img width=\"77px\" src=\"https://github.surmon.me/images/common/vue-logo.png\" />\n  </a>\n</p>\n\n# vue-awesome-swiper\n![vue](https://img.shields.io/badge/MADE%20WITH-VUE-42a97a?style=for-the-badge&labelColor=35495d)\n[![GitHub stars](https://img.shields.io/github/stars/surmon-china/vue-awesome-swiper.svg?style=for-the-badge)](https://github.com/surmon-china/vue-awesome-swiper/stargazers)\n[![npm](https://img.shields.io/npm/v/vue-awesome-swiper?color=c7343a&label=npm&style=for-the-badge)](https://www.npmjs.com/package/vue-awesome-swiper)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/surmon-china/vue-awesome-swiper/Publish?label=publish&style=for-the-badge)](https://github.com/surmon-china/vue-awesome-swiper/actions?query=workflow%3APublish)\n[![GitHub issues](https://img.shields.io/github/issues-raw/surmon-china/vue-awesome-swiper.svg?style=for-the-badge)](https://github.com/surmon-china/vue-awesome-swiper/issues)\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge)](https://github.com/surmon-china/vue-awesome-swiper/blob/master/LICENSE)\n\n[![NPM](https://nodei.co/npm/vue-awesome-swiper.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vue-awesome-swiper)\n\n**[Swiper](https://swiperjs.com)** component for Vue.\n\nOld versions:\n- Swiper 4: [v3.1.3](https://github.com/surmon-china/vue-awesome-swiper/tree/v3.1.3)\n- Swiper 3: [v2.6.7](https://github.com/surmon-china/vue-awesome-swiper/tree/v2.6.7) \n\n\n### Example\n- [Online examples](https://github.surmon.me/vue-awesome-swiper)\n- [CDN example](https://jsfiddle.net/surmon/kLtj6h3p/)\n- [SSR example code](https://github.com/surmon-china/surmon-china.github.io/tree/source/projects/vue-awesome-swiper/nuxt)\n- [TypeScript & composition-api example code](https://github.com/surmon-china/surmon-china.github.io/blob/source/projects/vue-awesome-swiper/examples/00-typescript-composition-api.vue)\n\n---\n\n### Install\n\n``` bash\nnpm install swiper vue-awesome-swiper --save\n\n# or\nyarn add swiper vue-awesome-swiper\n```\n\n### Global Registration\n\n``` javascript\nimport Vue from 'vue'\nimport VueAwesomeSwiper from 'vue-awesome-swiper'\n\n// import style\nimport 'swiper/css/swiper.css'\n\nVue.use(VueAwesomeSwiper, /* { default options with global component } */)\n```\n\n### Local Registration\n\n```javascript\nimport { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'\nimport 'swiper/css/swiper.css'\n\nexport default {\n  components: {\n    Swiper,\n    SwiperSlide\n  },\n  directives: {\n    swiper: directive\n  }\n}\n```\n\n### CDN\n\n``` html\n<link rel=\"stylesheet\" href=\"path/to/swiper.css\"/>\n<script type=\"text/javascript\" src=\"path/to/swiper.js\"></script>\n<script type=\"text/javascript\" src=\"path/to/vue.min.js\"></script>\n<script type=\"text/javascript\" src=\"path/to/dist/vue-awesome-swiper.js\"></script>\n<script type=\"text/javascript\">\n  Vue.use(window.VueAwesomeSwiper)\n</script>\n```\n\n---\n\n### Difference with usage\n\n**Directive and the only difference in the use of the Component:**\n- `component` find Swiper instance by [`ref attribute`](https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements).\n- `directive` find Swiper instance by [`directive arg`](https://vuejs.org/v2/guide/custom-directive.html#Dynamic-Directive-Arguments).\n\nOther configurations, events are the same. \n\nThe effect of the two ways and the difference in the applicable environment [is here](https://github.com/surmon-china/surmon-china.github.io/blob/source/projects/vue-awesome-swiper/nuxt/).\n\n\n### Component\n\n```html\n<template>\n  <swiper ref=\"mySwiper\" :options=\"swiperOptions\">\n    <swiper-slide>Slide 1</swiper-slide>\n    <swiper-slide>Slide 2</swiper-slide>\n    <swiper-slide>Slide 3</swiper-slide>\n    <swiper-slide>Slide 4</swiper-slide>\n    <swiper-slide>Slide 5</swiper-slide>\n    <div class=\"swiper-pagination\" slot=\"pagination\"></div>\n  </swiper>\n</template>\n\n<script>\n  export default {\n    name: 'carrousel',\n    data() {\n      return {\n        swiperOptions: {\n          pagination: {\n            el: '.swiper-pagination'\n          },\n          // Some Swiper option/callback...\n        }\n      }\n    },\n    computed: {\n      swiper() {\n        return this.$refs.mySwiper.$swiper\n      }\n    },\n    mounted() {\n      console.log('Current Swiper instance object', this.swiper)\n      this.swiper.slideTo(3, 1000, false)\n    }\n  }\n</script>\n```\n\n\n### Directive\n\n```html\n<template>\n  <div v-swiper:mySwiper=\"swiperOption\">\n    <div class=\"swiper-wrapper\">\n      <div class=\"swiper-slide\" :key=\"banner\" v-for=\"banner in banners\">\n        <img :src=\"banner\">\n      </div>\n    </div>\n    <div class=\"swiper-pagination\"></div>\n  </div>\n</template>\n\n<script>\n  export default {\n    data () {\n      return {\n        banners: [ '/1.jpg', '/2.jpg', '/3.jpg' ],\n        swiperOption: {\n          pagination: {\n            el: '.swiper-pagination'\n          },\n          // ...\n        }\n      }\n    },\n    mounted() {\n      console.log('Current Swiper instance object', this.mySwiper)\n      this.mySwiper.slideTo(3, 1000, false)\n    }\n  }\n</script>\n```\n\n---\n\n### Swiper component API\n\n```html\n<!-- All events/props support camelCase or kebab-case. -->\n<swiper\n  :options=\"swiperOptionsObject\"\n  :auto-update=\"true\"\n  :auto-destroy=\"true\"\n  :delete-instance-on-destroy=\"true\"\n  :cleanup-styles-on-destroy=\"true\"\n  @ready=\"handleSwiperReadied\"\n  @click-slide=\"handleClickSlide\"\n/>\n\n<!-- vue-awesome-swiper converts all Swiper events into component/directive events, e.g.: -->\n<swiper\n  @slide-change-transition-start=\"onSwiperSlideChangeTransitionStart\"\n  @slideChangeTransitionStart=\"onSwiperSlideChangeTransitionStart\"\n  @slideChangeTransitionEnd=\"...\"\n  @transitionStart=\"...\"\n  ...\n/>\n```\n```ts\ninterface IProps {\n  // Auto update swiper when vue component `updated`\n  autoUpdate?: boolean // default: true\n  // Auto destroy swiper when vue component 'beforeDestroy'\n  autoDestroy?: boolean // default: true\n\n  // swiper.destroy's params\n  // swiper.destroy(deleteInstanceOnDestroy, cleanupStylesOnDestroy)\n  deleteInstanceOnDestroy?: boolean // default: true\n  cleanupStylesOnDestroy?: boolean // default: true\n}\n\n// `@ready` event will emit when the Swiper instance mounted\nfunction handleSwiperReadied(swiper: Swiper) {\n  console.log('Swiper was munted!', swiper)\n}\n\n// `@click-slide` event has special treatment for Swiper's loop mode, which is still available in loop mode\nfunction handleClickSlide(index: number, reallyIndex: number | null) {\n  console.log('Click slide!', index, reallyIndex)\n}\n```\n\n### Swiper directive API\n\nBased on the exact same as the component API.\n\nIn the `directive` mode, the Swiper instance will be mounted in the parent's component context use the default name`$swiper`. In order to implement multiple swipers in a context, the `directive` has an additional name called `instanceName` API, through this API, you can easily control the name of each swiper mount context.\n\n```html\n<div v-swiper=\"swiperOptionsObject\" />\n<div v-swiper:secondSwiper=\"swiperOptionsObject\" />\n<div v-swiper:[dynamicSwiperName]=\"swiperOptionsObject\" />\n<div v-swiper=\"swiperOptionsObject\" instance-name=\"fourthSwiper\" />\n```\n```ts\nexport dafault {\n  data() {\n    return {\n      dynamicSwiperName: 'thirdSwiper'\n    }\n  },\n  mounted() {\n    console.log('Swiper instances:', this.$swiper, this.secondSwiper, this.thirdSwiper, this.fourthSwiper)\n  }\n}\n```\n\n### Swiper API\nSwiper's API and configuration can be used.\n\n- [EN Swiper events](https://swiperjs.com/api/#events)\n- [EN Swiper documentation](https://swiperjs.com/api/)\n- [ZH Swiper documentation](https://www.swiper.com.cn/api/index.html)\n\n---\n\n### [Custom Build with Swiper](https://swiperjs.com/api/#custom-build)\n\n```ts\nimport Vue from 'vue'\nimport { Swiper as SwiperClass, Pagination, Mousewheel, Autoplay } from 'swiper/js/swiper.esm'\nimport getAwesomeSwiper from 'vue-awesome-swiper/dist/exporter'\n\n// Swiper modules\nSwiperClass.use([Pagination, Mousewheel, Autoplay])\n\n// -------------------------------------------------\n\n// Global use\nVue.use(getAwesomeSwiper(SwiperClass))\n\n// -------------------------------------------------\n\n// Or local component\nconst { Swiper, SwiperSlide } = getAwesomeSwiper(SwiperClass)\nexport default {\n  components: {\n    Swiper,\n    SwiperSlide\n  }\n}\n```\n\n### Custom Swiper plugin\n\n```javascript\nimport SwiperClass from 'swiper'\n\nSwiperClass.use({\n  name: 'pluginName',\n  params: {\n    pluginSwitch: false,\n  },\n  on: {\n    init() {\n      if (!this.params.pluginSwitch) return\n      console.log('init')\n    },\n    // ...\n  }\n})\n\n// Your Swiper or App bussiness component...\n```\n---\n\n### Changelog\n\nDetailed changes for each release are documented in the [release notes](https://github.com/surmon-china/vue-awesome-swiper/blob/master/CHANGELOG.md).\n\n### License\n\n[MIT](https://github.com/surmon-china/vue-awesome-swiper/blob/master/LICENSE)\n","readmeFilename":"README.md"}