# vue-image-crop-upload **Repository Path**: gitee_store/vue-image-crop-upload ## Basic Information - **Project Name**: vue-image-crop-upload - **Description**: vue头像裁剪 - **Primary Language**: HTML/CSS - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-02-16 - **Last Updated**: 2022-02-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vue-image-crop-upload ## [中文文档](https://github.com/dai-siki/vue-image-crop-upload/blob/master/README-zh.md). A beautiful vue component for image crop and upload. **Notice**: This component is designed for pc, **not recommended for use on the mobile side**. [![GitHub issues](https://img.shields.io/github/issues/dai-siki/vue-image-crop-upload.svg)](https://github.com/dai-siki/vue-image-crop-upload/issues) [![GitHub forks](https://img.shields.io/github/forks/dai-siki/vue-image-crop-upload.svg)](https://github.com/dai-siki/vue-image-crop-upload/network) [![GitHub stars](https://img.shields.io/github/stars/dai-siki/vue-image-crop-upload.svg)](https://github.com/dai-siki/vue-image-crop-upload/stargazers) [![Twitter](https://img.shields.io/twitter/url/https/github.com/dai-siki/vue-image-crop-upload.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=%5Bobject%20Object%5D) [![NPM](https://nodei.co/npm/vue-image-crop-upload.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/vue-image-crop-upload/) ## Change log #### @3.0.0 - Compatible vue3 ## Demo [Click me](http://dai-siki.github.io/vue-image-crop-upload/example-3/demo.html). ## Screenshot ![screenshot](screenshot/1.png) ## Brower compatibility IE10+ ## Install #### npm ```shell $ npm install vue-image-crop-upload ``` ## Usage #### Props | Name | Type | Default | Description | | ----------------| ---------------- | ---------------| ------------------------------------------| | url | String | '' | Server api path,like "/avatar/upload", If empty, will not be uploaded | | method | String | 'POST' | request http method | | field | String | 'upload' | Upload input filename, used for server side get the file stream. | | value | Boolean | twoWay | show or not | | params | Object | null | POST Params,like "{k:v}" | | headers | Object | null | POST request header,like "{k:v}" | | langType | String | 'zh' | language type | | langExt | Object | | language extend | | width | Number | 200 | width of receive image | | height | Number | 200 | height of receive image | | imgFormat | string | 'png' | jpg/png, Server api receive file type. | | imgBgc | string | '#fff' | background color, if the imgFormat prop is jpg | | noCircle | Boolean | false | disable circle preview | | noSquare | Boolean | false | disable square preview | | noRotate | Boolean | true | disable rotate function | | withCredentials | Boolean | false | support cross-domain | #### Events | Name | Description | | ----------------| ------------------------------------------| | srcFileSet |Once you've selected the file, params( fileName, fileType, fileSize ) | | cropSuccess | image crop success, params( imageDataUrl, field ) | | cropUploadSuccess | upload success, params( jsonData, field ) | | cropUploadFail | upload fail, params( status, field ) | #### Language package [view details](http://dai-siki.github.io/vue-image-crop-upload/utils/language.js). #### Example Of "langExt" ```js { hint: 'Click or drag the file here to upload', loading: 'Uploading…', noSupported: 'Browser is not supported, please use IE10+ or other browsers', success: 'Upload success', fail: 'Upload failed', preview: 'Preview', btn: { off: 'Cancel', close: 'Close', back: 'Back', save: 'Save' }, error: { onlyImg: 'Image only', outOfSize: 'Image exceeds size limit: ', lowestPx: 'Image\'s size is too low. Expected at least: ' } } ``` #### Example vue@3 ```html
set avatar
``` #### Example vue@2 ```html
set avatar
``` #### Example vue@1 ```html
set avatar
```