vue滑动插件_一个无需设置图像大小即可进行照片滑动的Vue插件

vue滑动插件

Vue-Pswipe (vue-pswipe)

a Vue plugin for photoswipe without set image size.

一个无需设置图像大小即可进行照片滑动的Vue插件。

安装 (install)

npm install vue-pswipe

用法 (usage)

// main.js
import Photoswipe from 'vue-pswipe'
import Vue from 'vue'

Vue.use(Photoswipe, options)

complete options

完整的选项

you can use default slot, it will render img with src

您可以使用默认插槽,它将使用src渲染img

<!-- someComponent.vue -->
<Photoswipe>
    <PhotoswipeItem :src="imageSrc" />
</Photoswipe>

or you can use background-image instead of img, and image-item class is necessary for background-image, because its use for identified as thumbnail image element

或者您可以使用background-image而不是img,并且background-image需要image-item类 ,因为它用于标识为缩略图元素

<!-- someComponent.vue -->
<Photoswipe>
    <PhotoswipeItem :src="imageSrc">
        <div 
            class="image-item"
            :style="getBgImgStyle(src)"
        >
    </PhotoswipeItem>
</Photoswipe>

道具 (props)

Photoswipe

照片擦除

propertytypeexplain
optionsObjectoriginal photoswipe options
属性 类型 说明
选项 目的 原始的照片擦除选项

complete options

完整的选项

PhotoswipeItem

照片擦除项目

propertytypeexplain
srcStringimage src
属性 类型 说明
src 图像src

(example)

npm run dev

翻译自: https://vuejsexamples.com/a-vue-plugin-for-photoswipe-without-set-image-size/

vue滑动插件

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值