图片剪裁
安装
pnpm i @vueuse/shared
pnpm i cropperjs
二次封装组件
- 位置
src/views/demo/components/Cropper
属性说明
属性 | 类型 | 默认值 | 说明 |
---|---|---|---|
src | string | - | 图片源 |
alt | string | - | 图片 |
circled | boolean | false | 圆形裁剪框 |
realTimePreview | boolean | true | 实时触发预览 |
height | string | 360px | 高度 |
crossorigin | string | - | crossorigin |
imageStyle | object | `` | 图片样式 |
options | object | DefaultOptions | corpperjs 配置项 |
ts
{
aspectRatio: 1,
zoomable: true,
zoomOnTouch: true,
zoomOnWheel: true,
cropBoxMovable: true,
cropBoxResizable: true,
toggleDragModeOnDblclick: true,
autoCrop: true,
background: true,
highlight: true,
center: true,
responsive: true,
restore: true,
checkCrossOrigin: true,
checkOrientation: true,
scalable: true,
modal: true,
guides: true,
movable: true,
rotatable: true,
}