Giter Club home page Giter Club logo

vue-dark-photo's Introduction

先上效果图

demo1.gif

demo2 .gif

demo3.gif

演示地址

https://dark2017.github.io/vue-dark-photo.github.io/

vue-dark-photo

  • 基于 vue2.x 开发的预览图片组件
  • 支持 放大、缩小、复原、下载、打印、旋转、拖拽等功能
  • 支持png、jpg、jpge、bmp、gif等常见图片格式
  • 支持查看多个图片
  • 开箱即用 只需传图片数据 轻便简单
  • GitHub地址:https://github.com/Dark2017/vue-dark-photo.git

安装使用说明

vue-dark-photo

npm i vue-dark-photo

// 在入口(main.js)中引入并挂载
import VDPhoto from 'vue-dark-photo'
// 引入vue-dark-photo 样式
import 'vue-dark-photo/lib/vue-dark-photo.css'

Vue.use(VDPhoto)

//通过cdn引入 以下链接
https://cdn.jsdelivr.net/npm/vue-dark-photo@{verison}/lib/vue-dark-photo.umd.min.js
https://cdn.jsdelivr.net/npm/vue-dark-photo@{verison}/lib/vue-dark-photo.css

示例

调用全局方法打开(适合简单使用)

this.$VDPhoto.show({
    imgData: "url",
});

组件形式打开(适合需要额外功能)

<VDPhoto 
    ref="VDPhoto"
    :imgData='imgData'
    @publish='publish'
    ....
/>

api

属性

属性值 类型 描述 默认值
imgData string 图片地址(url) -
imgArr Array 图片地址(数组) -
isHint Boolean 是否展示提示(第一张或最后一张) true

事件

事件名 说明 回调参数
publish 打印后的回调 打印的内容
close 关闭后的回调 -

方法

方法名 说明
show 打开photo
··· ···

注意

  • 通过this.$refs.VDPhoto.show()来打开组件
  • 若引用图片地址,相对地址使用require()包裹或使用绝对地址
  • 若imgData 和 imgArr 同时传了 则只有imgData生效

最后

更新日志

  • 2021-5-22

  • 新增提示功能

  • 添加图片旋转动画

  • 优化图片旋转功能

  • 2021-5-21

  • 新增图片数组功能;移除默认插槽和图片名

  • 下载时截取文件名作为图片名

  • 2021-5-20

  • 解耦elementui、引用阿里图标库

  • 去除word等文档预览功能

  • 2021-5-17

  • 支持更多图片格式、代码优化

  • 2021-5-14

  • 去除打印的页眉、页脚优化打印相关功能

vue-dark-photo's People

Contributors

dark2017 avatar laihaoshan 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.