Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pic-viewer

Package Overview
Dependencies
Maintainers
4
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pic-viewer

开箱即用、支持表格嵌套的图片预览器

  • 0.3.1
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by42.86%
Maintainers
4
Weekly downloads
 
Created
Source

pic-viewer / 图片预览

before preview


previewing

Features

  • viewerjs 的 vue 版本 增加了预览前的外部展示 使其开箱即用
  • √ 灵活的展示形式:支持文档流、轮播图、自适应瀑布流、嵌套在表格内
  • √ 灵活的数据类型:支持字符串、字符串数组、对象数组
  • √ 支持二维码
  • √ 全局或局部引入 参数支持全局或局部配置

Installation

NPM

Dependencies:vue

// 全局引入

import 'pic-viewer/dist/style.css'
import PicViewer from 'pic-viewer'

Vue.use(PicViewer, {
  // 全局配置
})
<!-- 局部引入 -->

<template>
  <PicViewer v-bind="config"/>
</template>

<script>
import 'pic-viewer/dist/style.css'
import PicViewer from 'pic-viewer'

export default {
  components: { PicViewer },
  data () {
    return {
      config: {
        // 局部配置
      }
    }
  }
}
</script>

Props

AttributeDescriptionTypeOptionsDefault
valueimg link(s)string / array[string] / array[object]
patterndisplay patternstring'waterfall', 'swiper', 'table-cell'undefined, means normal flow
objectKeyif type of value is array[object], you need to specify the img key of objectstring
swiperProps*props of swiperobject
qrcode*turning value into qrcodeboolean, stringtrue, false, 'auto'false
qrcodeProps*props of qrcode dependencyobject

qrcode

::: tip
如果将 qrcode 设为 'auto',pic-viewer 会自动判断是否需要转换(value 为 base64 或 url 时不会转换) :::

qrcodeProps

// 默认值

{
  margin: 0,
  scale: 400,
  errorCorrectionLevel: 'L',
  width: 148,
  height: 148,
}

swiperProps

// 默认值

{
  observer: true,
}

Methods

MethodDescriptionParameters
previewpreview manuallyindex of value array (default: 0)

Use Cases

Preview manually, no external display


<PicViewer :value="" v-show="false" ref="PicViewer"/>
<button @click="()=>{$refs.PicViewer.preview(6)}">preview</button>

Keywords

FAQs

Package last updated on 19 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc