Giter VIP home page Giter VIP logo

picture-preview-vue's Introduction

图片预览功能,兼容移动端单指拖动,双指缩放功能

picture-preview-vue

Demo

Github

Install

npm install --save picture-preview-vue

Usage

import PicturePreviewVue from 'picture-preview-vue'

// 预览单张图片
PicturePreviewVue('https://file.iviewui.com/images/image-demo-2.jpg')


// 预览多张图片
PicturePreviewVue({
  url: 'https://file.iviewui.com/images/image-demo-2.jpg',
  urlList: [
    'https://file.iviewui.com/images/image-demo-1.jpg',
    'https://file.iviewui.com/images/image-demo-2.jpg',
    'https://file.iviewui.com/images/image-demo-3.jpg',
    'https://file.iviewui.com/images/image-demo-4.jpg',
    'https://file.iviewui.com/images/image-demo-5.jpg',
    'https://file.iviewui.com/images/image-demo-6.jpg'
  ] // 当前图片所在列表
})

PicturePreviewVue 方法接收一个参数,字符串或对象:

  • 字符串,必须传入一个 url 地址;
  • 对象,url 传入当前图片地址,urlList 传入当前图片所在列表数据。

预览时,可以使用键盘 ←、→ 切换图片,↑、↓ 缩放图片,Space 显示 1:1 图片,ESC 退出预览。

使用示例

picture-preview-vue's People

Contributors

liuzhenghe30265 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.