vue image cropper by cropperjs
npm install @ballcat/vue-cropperA Vue image cropper components by cropperjs.
Github: https://github.com/ballcat-projects/vue-cropper
online demo: https://ballcat-projects.github.io/vue-cropper
You can also clone the repository and run the demo locally:
``shellclone
git clone https://github.com/ballcat-projects/vue-cropper.git
Getting started
$3
`npm
npm install @ballcat/vue-cropper
`
or
`yarn
yarn add @ballcat/vue-cropper
`$3
#### Global Registration
`vue
import { createApp } from 'vue';
import App from './App';import VueCropper from '@ballcat/vue-cropper';
import 'cropperjs/dist/cropper.css';
const app = createApp(App);
app.use(VueCropper).mount('#app');
`#### Local Registration
`vue
ref="vueCropperRef"
:src="imgSrc"
alt="Source Image"
/>
`or use setup script
`vue
``VueCropper props that can be used are divided into two parts, custom and all properties supported by cropperjs
| Property | Description | Type | Required |
| :------------- | :------------------------------------------ | :------ | :------- |
| src | origin image src | string | true |
| imgStyle | the img element style | object | -- |
| imgCrossOrigin | the img element crossOrigin attribute value | string | -- |
| alt | the img element alt attribute value | boolean | -- |
| Method | Description | Type |
|:--------|:------------------------------|:-----------|
| flipX | flip the picture horizontally | () => void |
| flipY | flip the picture vertically | () => void |