1.0.6 • Published 4 years ago

ln-image-uploader v1.0.6

Weekly downloads
32
License
-
Repository
-
Last release
4 years ago

GitHub GitHub package.json version GitHub stars npm npm bundle size

文档&&示例地址

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

示例

 <g-uploader
                height="80"
                width="80"
                :action=URL
                :imageCut="true"
                name="file"
             		:blob='true'
                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上传图片地址-String
imageCut是否开启剪裁模式(注:开启剪裁模式后,每次只能上传一张图片)trueBoolean
name传给后台的 name-String
method方法POSTString
parseResponse响应处理函数-Function
fileList文件列表 Array
addFile更新文件列表函数(按照示例写在项目中即可)-Function
height图片和添加图片按钮的高度80String||Number
width图片和添加图片按钮的宽度80String||Number
blob默认为base64上传,blob=true 以blob对象上传FalseBoolean