1.0.9 • Published 7 years ago

vue-image-crop-compress-upload v1.0.9

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

vue-image-crop-compress-upload

a vue plgin for image upload , crop and compress(vue图片剪裁压缩上传插件).

Notice: This component is designed for pc, not recommended for use on the mobile side.(该组件适用于pc端,不推荐手机端使用)

GitHub issues GitHub forks GitHub stars Twitter

NPM

Brower compatibility

IE10+

Install

npm

$ npm install vue-image-crop-compress-upload

Usage

Props

名称类型默认说明
fieldString'upload'Upload input filename, used for server side get the file stream.
valueBooleantwoWayshow or not
urlString''Server api path,like "/avatar/upload"
paramsObjectnullPOST Params,like "{k:v}"
headersObjectnullPOST request header,like "{k:v}"
langTypeString'zh'language type
langExtObjectlanguage extend
widthNumber200width of receive image
heightNumber200height of receive image
imgFormatstring'jpg'jpg/png, Server api receive file type.

Events

名称说明
cropSuccessimage crop success, params( imageDataUrl, field )
cropUploadSuccessupload success, params( jsonData, field )
cropUploadFailupload fail, params( status, field )

Example vue

<template>
 <s-upload :init-src='ruleForm.photo' @uploadImg="changeImg" field='localFile' url='/wcsphp/uploadfile.php' textShow='true'></s-upload>
</template>
<script>
  import SUpload from 'vue-image-crop-compress-upload/stager-image-crop-compress-upload.vue'

  export default {
    components: {
      SUpload
    },
    methods: {
      changeImg(imageData) {
        console.log(imageData)
      }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .user-info-edit-form-wrapper {
    width: 30rem;
    margin: 0 auto;
  }
  .vue-image-crop-upload .vicp-wrap .vicp-step2 .vicp-crop .vicp-crop-left .vicp-img-container .vicp-img-shade {
    background: none;
  }
</style>
1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago