0.2.0 • Published 5 years ago

vue-lnsoft-uploader v0.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

文档&&示例地址

https://storm4542.github.io/vue-lnsoft-uploader/

示例

 <g-uploader
                height="80"
                width="80"
                :action=URL
                :imageCut="true"
                name="file"
                method="POST"
                :parseResponse="parseResponse"
                @addFile=addFile
                :file-list.sync="fileList"
        >
</g-uploader>
 export default {
        data() {
            return {
                fileList: [],
                URL: 'https://image-server-gulu.herokuapp.com/upload',
            };
        },
        methods: {
            parseResponse(response) {
              	//对response做处理
               	// ...
                return response;
            },
            addFile(file) { 
              //固定写入
                this.fileList.push(file);
            }
        }
    };

API

名称描述默认值是否必须
action上传图片地址-
imageCut是否开启剪裁模式(注:开启剪裁模式后,每次只能上传一张图片)true
name传给后台的 name-
method方法POST
parseResponse响应处理函数-
fileList文件列表
addFile更新文件列表函数(按照示例写在项目中即可)-
height图片和添加图片按钮的高度80
width图片和添加图片按钮的宽度80