Giter VIP home page Giter VIP logo

vue-pic-clip's Introduction

vue-pic-clip

一个简单的移动端裁剪图片上传插件

预览demo.

### 安装 Install
npm install vue-pic-clip -D

// 组件内使用
import { VueClip }  from 'vue-pic-clip'
components: {
  VueClip,
},

// main.js里面使用
import VueClip from 'vue-pic-clip'

Vue.use(VueClip)
<vue-clip
  :img=""
  :autoClip="option.autoClip"
  :outputSize="option.outputSize"
  @finish="finish"
>上传头像</vue-clip>

配置参数

名称 功能 默认值 可选值
img 默认图片地址 url地址
accept 上传图片类型 'image/png, image/jpeg, image/jpg, image/gif' jpeg
autoClip 是否生成截图框 false ture
autoClipWidth 截图框的宽度 容器宽度80% 0~容器宽度
autoClipHeight 截图框的高度 与宽度相等 0~容器宽度
canMove 图片能否拖动 true true
canMoveBox 截图框能否拖动 ture ture
dataUrlType 输出图片数据类型 blob base64
fixed 截图框是否开启固定宽高比 false true
fixedNumber 截图框宽高比 [1,1] [宽度,高度]
fixedBox 固定截图框大小 false true
isOriginalImg 是否上传原图 false true
maxWidth 生成图片的最大宽度 600 0~max(启用裁剪或上传原图时最大宽度无效)
maxHeight 生成图片的最大高度 600 0~max(同上)
outputSize 输出图片压缩比 1 0.1-1
outputType 生成图片的格式 jpeg jpeg
theme 样式风格 rect rect
finish 完成操作事件 回调函数

主要研究vue-cropper的源码开发学习。一直使用这个插件做项目,最近比较闲,就撸了一个更简单的适合我自己用的插件。没有大量真机测试过,有什么问题,欢迎大家提Issues给我。

写个插件玩玩,给个star,多多支持,谢谢

Thanks to

vue-pic-clip's People

Contributors

tianyazz avatar

Watchers

 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.