1.0.16 • Published 5 years ago

vue-cropblg v1.0.16

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

vue-cropblg

vue 图片裁剪插件

演示链接(戳我直达)

Installation

$ npm install vue-cropblg
$ yarn add vue-cropblg

Usage

<template>
   <crop/>
   ...
</template>

组件内引入
import { crop } from "vue-cropblg";
 ...
components: {
  crop
},
 
全局引入
import crop from "vue-cropblg";
Vue.use(crop)

API

Attributes

参数说明类型可选值默认值
v-model组件Object----
shape截图形状Stringrect/arc/imgagerect
position水印位置大小角度x,y,size,angleArray--'90%', '90%',1,0
textWatermark文字水印]String----
imageWatermark图片水印File / String----
defaultImgUrl默认图片File / String----
angle按钮旋转角度Number--0
color水印.编辑框.控制按钮颜色String16进制颜色反差最大颜色
rotation水图片在canvas旋转角度,能动态改变,rotateBtn为false有效Number----
penBtn是否渲染画笔按钮Booleantrue / falsefalse
revokeBtn是否渲染撤销按钮Booleantrue / falsefalse
rotateBtn是否渲染旋转按钮Booleantrue / falsefalse

补充说明

画布中的图片是支持 单指拖动的,双指缩放的 (画笔激活状态下手势会被禁掉)

Methods

方法名说明参数
changeImage改变处理图片,如果没有传imgAddress,会打开本地Function(imgAddress: String)
getImage获取处理后图片,返回Promise,可以选择返回 base64和bolb,quality为文件压缩比(大小)Function(type:Base64 / Bolb, mimeType:image/jpeg / image/png, quality:Number)
imgLoaded图片canvas加载完成,对调用此函数--

这两个Methods 都是组件内置的:通过ref或v-model 调用

changeImage() 1. 直接调用,默认会打开本地文件选择 2.changeImage('url') 传入图片 网络url 会编辑该链接图片
getImage() 1.直接调用:默认参数:getImage('Base64','image/png', 2)
type 可选值: Base64和 Bolb, mimeType 可选值:'image/jpeg' 和 'image/png', quality: 默认最佳

Slot

name说明
placeholder没有图片时占位图
defaultImgUrl默认处理图片
1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago