当前位置:网站首页>图片裁剪插件cropper.js
图片裁剪插件cropper.js
2022-07-02 05:51:00 【想吃凤梨酥】
安装
npm install cropperjs
引入
import 'cropperjs/dist/cropper.css';
import Cropper from 'cropperjs';
使用
const letImg: any = document.querySelector("#cropImg");
(<any>state.cropper) = new Cropper(letImg, {
viewMode: 1,
dragMode: "none",
initialAspectRatio: 1,
aspectRatio: 1,
preview: ".before",
background: false,
autoCropArea: 0.6,
zoomOnWheel: false,
crop: () => {
state.cropperImgBase64 = (<any>state.cropper)
.getCroppedCanvas()
.toDataURL("image/jpeg");
console.log(state.cropperImgBase64);
},
});
注意:
- 不能直接用本地图片
- 可以用上传预览的图片
边栏推荐
- [leetcode] day92 container with the most water
- Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?
- all3dp. All Arduino projects in com website (2022.7.1)
- Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash
- "Simple" infinite magic cube
- Centos8 installation mysql8.0.22 tutorial
- 3D printer G code command: complete list and tutorial
- Vscode paste image plugin saves image path settings
- Software testing - concept
- 【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
猜你喜欢

正则表达式总结

【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

Lingyunguang rushes to the scientific innovation board: the annual accounts receivable reaches 800million. Dachen and Xiaomi are shareholders

Stick to the big screen UI, finereport development diary

Matplotlib double Y axis + adjust legend position

Fundamentals of software testing

3D 打印机 G 代码命令:完整列表和教程

Installation du tutoriel MySQL 8.0.22 par centos8

RGB 无限立方体(高级版)

Lantern Festival gift - plant vs zombie game (realized by Matlab)
随机推荐
mysql的约束总结
Software testing Q & A
我所理解的DRM显示框架
Importation de studio visuel
Fabric. JS iText set italics manually
Opencv LBP features
PHP read file (read JSON file, convert to array)
[Chongqing Guangdong education] selected reading reference materials of British and American literature of Nanyang Normal University
小程序跳装到公众号
【LeetCode】Day92-盛最多水的容器
php读文件(读取文件内含有某字符串的指定行)
PHP gets CPU usage, hard disk usage, and memory usage
[personal test] copy and paste code between VirtualBox virtual machine and local
3D printer G code command: complete list and tutorial
1037 Magic Coupon
Cube magique infini "simple"
idea开发工具常用的插件合集汇总
Huawei Hongmeng OS, is it OK?
Basic use of form
PHP parent