项目作者: wei-zhe

项目描述 :
A Vue component to drag-screenshot
高级语言: Vue
项目地址: git://github.com/wei-zhe/vue-drag-screenshot.git
创建时间: 2018-10-31T10:15:38Z
项目社区:https://github.com/wei-zhe/vue-drag-screenshot

开源协议:

下载


vue-drag-screenshot

A Vue component to drag-screenshot
一个图片裁剪工具

demo演示

demo

安装

  1. npm install vue-drag-screenshot -S

使用

  1. // ES6
  2. import vuedragscreenshot from 'vue-drag-screenshot'
  3. Vue.use(vuedragscreenshot)
  4. <vue-screenshot
  5. v-model="parentValue"
  6. :width="500"
  7. :height="500"
  8. :imageSrc='imageSrc'
  9. :control = 'control'
  10. >
  11. </vue-screenshot>
  12. control : {
  13. narrow : true, // 缩小
  14. clears : true, // 清除
  15. restore : true, // 还原
  16. blowup : true, // 放大
  17. wheel : true, // 滚轮缩放 ** 新增
  18. uniform : true, // uniform状态 ** 新增
  19. dragBox : { // 新增拖拽盒子固定尺寸/比例** 新增
  20. width : 160,
  21. height : 90,
  22. }
  23. }

wheel

滚动属性,当滚动属性开启时,支持滚轮放大图片;

uniform

当uniform属性开启时,每次截取区域截图都会自动居中滚轮放大会由图片转至放大选框

v-model

实时刷新的截图

  1. // ES6
  2. <img :src="parentValue"/>

Props

name Description type default type
width 截图区域宽 Number 500 (必传)
height 截图区域高 Number 500 (必传)
imageSrc 传入需要裁剪的图片 String 选择参数,也可以不传
control 组建功能按钮 Object 选择参数,也可以不传

dragScreenshot