Preface: do not have what can say, go up first realize effect !!!!
Effect:
Supported functions:
- Cropping images online (choose PNG, JPG, JPEG images freely)
- Automatically adjust the image generation quality (0.1-1) note that the image will become blurred when it is lower than 1
- Dynamically modify the clipping box size
- Whether the picture allows a scroll wheel
- Crop the generated picture output in proportional multiples
- There are many more that are not outlined here
Method of use
- NPM install vue-cropper or YARN add vue-cropper
- import { VueCropper } from ‘vue-cropper’
- Use it to finish up the code
- Configure parameters in data
- Description of plug-in parameters
- Built-in methods
- Save cropped image
$refs.cropper.getCropdata ((data) => {// do something console.log(data)})
$refs.cropper.getcropblob ((data) => {// do something console.log(data)})
Matters needing attention
Vue. Js often uses V-if and V-show. Remember to use V-if if you want the cropping function to dynamically display and hide images within the component.