0.1.5 • Published 2 years ago

@luohc92/vue-image-viewer v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vue-image-viewer

A image viewer for vue2.x

Install

npm i @luohc92/vue-image-viewer

Usage

import ImageViewer from "@luohc92/vue-image-viewer";
Vue.use(ImagePreview)
  this.$imageViewer({
    images: images,
    curIndex: 0,
    zIndex: 2000,
    showDownload: true,
    showThumbnail: true,
    handlePosition: "bottom",
    maskBgColor: "rgba(0,0,0,0.7)",
    onClose: () => {
      console.log("close");
    },
  });

Props

NameTypeRequiredDescriptionDefault
imagesArraytrueimages source 图片源[]
curIndexNumberfalsedefault display image 默认显示图片0
zIndexNumberfalseset image viewer z-index 设置图片查看器的 z-index2000
showDownloadBooleanfalseshow download button 显示下载按钮false
showThumbnailBooleanfalseshow images thumbnail 显示图片缩略图false
handlePositionString top,bottomfalseset handle position 设置操作柄显示位置bottom
maskBgColorStringfalseset mask background color 设置遮罩背景颜色rgba(0,0,0,0.7)
onCloseFunctionfalseclose function callback 关闭方法回调null
onDownloadFunctionfalsedownload image function callback 关闭方法回调null

Keyboard Shortcuts

KeyboardAction
arrow-leftprev 上一张
arrow-rightnext 下一张
arrow-upzoomIn 放大
arrow-downzoomOut 缩小
altclockwise rotation 顺时针旋转
ctrlmirror 镜像翻转
spacetoggle image size mode contain,original 图片显示大小模式自适应大小,原始大小
escclose 关闭

Demo

[Demo Image]

0.1.4

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago