1.0.19 • Published 6 years ago

xh-image-preview v1.0.19

Weekly downloads
22
License
MIT
Repository
github
Last release
6 years ago

xh-image-preview

基于vue图片预览插件

说明

  1. 具有预览图片基本功能:放大、缩小、1:1、旋转、拖拽、左右切换
  2. 灵活配置:支持图片预览窗尺寸、操作按钮键可配置

使用

#安装
npm install xh-image-preview 
#引入
import xhImagePreview from 'xh-image-preview'
Vue.use(xhImagePreview)
基本用法
#预览单张图
<xh-image-preview :visible.sync="visible" :images="images"></xh-image-preview>

#预览多张图
#支持左右切换,defaultImage为打开窗口第一张图片,默认为传入图片数组中第一张
<xh-image-preview :visible.sync="visible" :images="images" :defaultImage="defaultImage"></xh-image-preview>
属性设置
#设置图片预览窗尺寸:600px*500px
<xh-image-preview :visible.sync="visible" :images="images" width="600px" height="500px"></xh-image-preview>

#设置图片操作按钮键:默认zoomIn,zoomOut,actualSize,rotate,total
<xh-image-preview :visible.sync="visible" :images="images" layout="zoomIn,zoomOut,rotate"></xh-image-preview>

属性介绍

参数说明类型可选值默认值
visible控制图片预览弹显示/隐藏Booleanfalse
images预览图片集Array
defaultImage默认图片stringimages0
width/height预览窗宽/高string750px/536px
layout操作按钮, 参数名用逗号分隔stringzoomIn,zoomOut,actualSize,rotate,totalzoomIn,zoomOut,actualSize,rotate,total

方法

方法名称说明
prev预览上一张图片
next预览下一张图片
rotate逆时针旋转图片
zoomIn放大图片
zoomOut缩小图片
actualSize预览图片1:1尺寸

演示地址

http://193.112.40.54:6400/#/

修改记录

2019年8月19日

监听images属性动态变化,更新当前预览图片信息

2019年8月27日

预览图片弹窗层滚动事件阻止冒泡

2019年10月21日

监听图片动态变化,更新当前预览图片信息

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.4

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago