vuejs签名库_VueJS响应式和可自定义的图像和视频库

vuejs签名库

Vue画廊 (vue-gallery)

VueJS responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.

VueJS响应式和可自定义的图像和视频库,轮播和灯箱,已针对移动和桌面Web浏览器进行了优化。

安装 (Install)

CDN (CDN)

Recommended: https://unpkg.com/vue-gallery, which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at https://unpkg.com/vue-gallery/

推荐: https : //unpkg.com/vue-gallery ,它将在发布到npm时立即反映最新版本。 您也可以在https://unpkg.com/vue-gallery/浏览npm软件包的源代码。

NPM (NPM)
npm install vue-gallery --save
(Yarn)
yarn add vue-gallery

开发设置 (Development Setup)

# install dependencies
npm install

# build dist files
npm run build

用法 (Usage)

VueJS单个文件(ECMAScript 2015) (VueJS single file (ECMAScript 2015))

<template>
  <div>
    <gallery :images="images" :index="index" @close="index = null"></gallery>
    <div
      class="image"
      v-for="(image, imageIndex) in images"
      :key="imageIndex"
      @click="index = imageIndex"
      :style="{ backgroundImage: 'url(' + image + ')', width: '300px', height: '200px' }"
    ></div>
  </div>
</template>

<script>
  import VueGallery from 'vue-gallery';
  
  export default {
    data: function () {
      return {
        images: [
          'https://dummyimage.com/800/ffffff/000000',
          'https://dummyimage.com/1600/ffffff/000000',
          'https://dummyimage.com/1280/000000/ffffff',
          'https://dummyimage.com/400/000000/ffffff',
        ],
        index: null
      };
    },

    components: {
      'gallery': VueGallery
    },
  }
</script> 

<style scoped>
  .image {
    float: left;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    border: 1px solid #ebebeb;
    margin: 5px;
  }
</style>

浏览器(ES5) (Browser (ES5))

<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/vue.js"></script>
  <script type="text/javascript" src="https://unpkg.com/[email protected]/js/blueimp-helper.js"></script>
  <script type="text/javascript" src="https://unpkg.com/[email protected]/js/blueimp-gallery.js"></script>
  <script type="text/javascript" src="https://unpkg.com/[email protected]/js/blueimp-gallery-fullscreen.js"></script>
  <script type="text/javascript" src="vue-gallery.js"></script>
  <link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/css/blueimp-gallery.min.css">

<div id="app">
  <gallery :images="images" :index="index" @close="index = null"></gallery>
  <div
    class="image"
    v-for="image, imageIndex in images"
    @click="index = imageIndex"
    :style="{ backgroundImage: 'url(' + image + ')', width: '300px', height: '200px' }"
  ></div>
</div>

<script type="text/javascript">
  new Vue({
    el: '#app',
    data: function () {
      return {
        images: [
          'https://dummyimage.com/800/ffffff/000000',
          'https://dummyimage.com/1600/ffffff/000000',
          'https://dummyimage.com/1280/000000/ffffff',
          'https://dummyimage.com/400/000000/ffffff'
        ],
        index: null
      };
    },

    components: {
      'gallery': VueGallery
    }
  });
</script>

道具 (Props)

PropsTypeDefaultDescription
imagesArray[]Urls list
indexNumbernullOpened image index
optionsObjectblueimp-gallery options
道具 类型 默认 描述
图片 数组 [] 网址清单
指数 空值 打开的图片索引
选项 目的 blueimp-画廊选项

大事记 (Events)

NameParamsDescription
onopen
onopened
onslide
onslideend
onslidecomplete
onclose
onclosed
名称 参数 描述
开启
滑行
幻灯片
完整的
关闭
开闭

翻译自: https://vuejsexamples.com/vuejs-responsive-and-customizable-image-and-video-gallery-2/

vuejs签名库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值