@halobear/viewer
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@halobear/viewer

类似微信图片预览插件,支持缩放、手势、方向键翻页

➡️ Live DEMO

使用

import preview from "@halobear/viewer"

// var data = [
//   'https://www.luzhongkuan.cn/static/temp/0b97b79a76eb5d3e29582778ab2ea0bc.jpeg',
//   'https://www.luzhongkuan.cn/static/temp/41a3582cc2eb461e68ebfbc768ee81e1.jpeg',
//   'https://www.luzhongkuan.cn/static/temp/51a7c6fdb1a6de91e021d5faf951fcdc.jpeg',
//   'https://www.luzhongkuan.cn/static/temp/27b1d178d4a1d06d93866a3866843d03.jpeg',
// ]

interface ViewerOptions {
  data: string[]
  container?: HTMLDivElement
  gap?: number
  screenWidth?: number
  screenHeight?: number
  index?: number
  onChange?: (index: number) => void
}

// 预览
const destroy = preview(options: ViewerOptions, e?: MouseEvent | TouchEvent)

// 关闭
destory()

@halobear/viewer

Readme

Keywords

none

Package Sidebar

Install

npm i @halobear/viewer

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

107 kB

Total Files

15

Last publish

Collaborators

  • wtwei
  • luzhongk
  • v_yan_v