Give me a star, big man

Making: github.com/Storm4542/v…

Document && sample address

Storm4542. Making. IO/vue – picture…

The sample

 <g-uploader
                height="80"
                width="80"
                :action=URL
                :imageCut="true"
                name="file"
                method="POST"
                :parseResponse="parseResponse"
                @addFile=addFile
                :file-list.sync="fileList"
        >
</g-uploader>
Copy the code
 export default {
        data() {
            return {
                fileList: [].URL: 'https://image-server-gulu.herokuapp.com/upload'}; },methods: {
            parseResponse(response) {
              	// Do something about response
               	// ...
                return response;
            },
            addFile(file) { 
              // Fixed write
                this.fileList.push(file); }}};Copy the code

API

The name of the describe The default value Whether must The data type
action Upload picture address is String
imageCut Whether to enable clipping mode (Note: After clipping mode is enabled, only one image can be uploaded at a time) true no Boolean
name Name passed to the background is String
method methods POST no String
parseResponse Response handling function is Function
fileList File list [] no Array
addFile Update the file list function (as shown in the example in the project) is Function
height Height of picture and add picture button 80 no String||Number
width Picture and add picture button width 80 no String||Number