Vue.js的响应式图片库和幻灯片组件 – vue-gallery-slideshow

Vue.js的响应式图片库和幻灯片组件 – vue-gallery-slideshow

插件名称:vue-gallery-slideshow

发布时间:2020年7月16日

插件作者:KitchenStories

官网 演示 GitHub下载

轻巧,易用,响应迅速的图库组件,可在带有缩略图导航的嵌入式幻灯片显示弹出窗口中显示图像。

变更日志:

v1.5.2(08/24/2020)

  • 修复关闭事件时,您应该返回上一个索引imgIndex

v1.5.1(07/14/2020)

  • 在项目包中添加了vue-runtime-helpers

安装和下载:

# NPM
$ npm install vue-gallery-slideshow --save

使用:

HTML

<div id="app">
  <img class="image" v-for="(image, i) in images" :src="image" :key="i" @click="index = i">
  <vue-gallery-slideshow :images="images" :index="index" @close="index = null"></vue-gallery-slideshow>
</div>

JavaScript

import VueGallerySlideshow from 'vue-gallery-slideshow';

const app = new Vue({
  el: '#app',
  components: {
    VueGallerySlideshow
  },
  data: {
    images: [
      'https://placekitten.com/801/800',
      'https://placekitten.com/802/800',
      'https://placekitten.com/803/800',
      'https://placekitten.com/804/800',
      'https://placekitten.com/805/800',
      'https://placekitten.com/806/800',
      'https://placekitten.com/807/800',
      'https://placekitten.com/808/800',
      'https://placekitten.com/809/800',
      'https://placekitten.com/810/800'
    ],
    index: null
  }
});
相关插件