1.0.4 • Published 9 months ago

@shawyu/image-preview v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@shawyu/image-preview

imagePreview是一个轻量级、无依赖的JavaScript插件,可以网页中实现图片预览功能,快速查看图片的大图,并提供了一些基本的交互功能,如放大、缩小、旋转等。

Github地址

https://github.com/shawyuu/js-plugin/tree/main/imagePreview

Getting started

Install

npm install @shawyu/image-preview

In browser

<script src="../imagePreview/index.js"></script>

Usage

import ImagePreview from '@shawyu/image-preview'

/*单图预览*/
ImagePreview.show({
	src:"图片路径",
	success:()=>{},
	fail:()=>{}
})

/*多图预览*/
ImagePreview.show({
	urls:["图片路径1","图片路径2"]
})

ImagePreview.show({
	src:"图片路径1",
	urls:["图片路径1","图片路径2"]
})

All Props

属性类型默认值必需描述
srcstring""NO要预览的图片路径,多图预览非必需(或为urls其中一张路径),单图预览必需
urlsArray<string>[]NO多图预览时(必填)的图片路径列表
successfunctionNO图片加载成功后的回调函数
failfunctionNO图片加载失败后的回调函数

Logs

1.0.0 version\ 1.0.2 Adapt to mobile devices

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

12 months ago