Gathering detailed insights and metrics for vue-file-upload
Gathering detailed insights and metrics for vue-file-upload
Gathering detailed insights and metrics for vue-file-upload
Gathering detailed insights and metrics for vue-file-upload
vue-upload-component
Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter
vue-image-crop-upload
a vue plgin for image upload and crop(vue图片剪裁上传插件)
@opentiny/vue-file-upload
vue-ele-upload-file
对 element-ui upload 组件进一步封装, 使其更简单、易用
npm install vue-file-upload
Typescript
Module System
Node Version
NPM Version
JavaScript (86.17%)
Vue (13.83%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
320 Stars
76 Commits
105 Forks
18 Watchers
15 Branches
3 Contributors
Updated on Jun 15, 2025
Latest Version
0.1.12
Package Id
vue-file-upload@0.1.12
Unpacked Size
229.85 kB
Size
65.98 kB
File Count
22
NPM Version
5.8.0
Node Version
7.9.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
vue1.x版本 可安装vue-file-upload@0.0.7版本
vue2.x版本 可安装当前最新版本
vue.js ,vue-loader 上传文件,vue-file-upload 代码里面包含demo,运行:
1yarn install && yarn sart
1npm install --save vue-file-upload
1var VueFileUpload = require('vue-file-upload'); 2//es6 3import VueFileUpload from 'vue-file-upload';
1//目标服务器地址 2url:{ 3 type:String, 4 required:true 5}, 6//最大文件上传数 7max:{ 8 type:Number, 9 default:Number.MAX_VALUE 10}, 11//文件名称(服务端识别的上传文件名) 12name:{ 13 type:String, 14 default:'file' 15}, 16//自动上传 17autoUpload:{ 18 type:Boolean, 19 default:false 20}, 21//支持多选文件上传 22multiple:{ 23 type:Boolean, 24 default:false 25}, 26//每新增一个待上传文件回调函数 27onAdd:{ 28 type:Function, 29 default:noop 30}, 31//过滤函数 32filters:{ 33 type:Array, 34 default:()=>{ 35 return new Array(); 36 } 37}, 38//请求附带参数 39requestOptions:{ 40 type:Object, 41 default:()=>{ 42 return{ 43 formData:{}, 44 headers:{}, 45 responseType:'json', 46 withCredentials:false 47 } 48 } 49}, 50//文件上传状态回调函数 51events:{ 52 type:Object, 53 default:()=>{ 54 return { 55 onProgressUpload:noop(file,progress:number),//上传进度回调 56 onCompleteUpload:noop(file,response,status,headers),//上传完成回调,不论成功或失败都调用 57 onErrorUpload:noop(file,response,status,headers),//上传失败回调 58 onSuccessUpload:noop(file,response,status,headers),//上传成功回调 59 onAbortUpload:noop(file,response,status,headers),//取消上传 60 onAddFileFail:noop(file,failFilter:array),//添加待上传文件失败回调,会通过filters过滤函数校验,不通过回调此函数 61 onAddFileSuccess:noop(file)//添加待上传文件成功回调 62 } 63 } 64} 65
1<vue-file-upload> 2 <span slot="label">上传文件</span> 3</vue-file-upload> 4
1const file = { 2 name:"文件名称",//文件名称 3 size:123,//文件大小 4 type:"image/jpeg",//文件类型 5 isReady: false,//,点击上传后,即将准备好上传 6 isUploading:false,//正在上传 7 isUploaded:false,//上传后 8 isSuccess:false,//成功上传 9 isCancel:false,//取消上传 10 isError:false,//上传失败 11 progress:0,//上传进度 12} 13 14//file 函数(method) 15file.upload(); //上传该文件 16file.cancel();//取消上传 17file.remove();//移除该文件 18
1this.$refs.vueFileUploader.uploadAll()//上传所有队列中的文件 2this.$refs.vueFileUploader.clearAll()//清空队列文件 3this.$refs.vuefileUploader.setFormDataItem( key, value );//设置formdata
app.vue
1<template lang="jade"> 2vue-file-upload(url='upload.do', 3 ref="vueFileUploader", 4 v-bind:filters = "filters", 5 v-bind:events = 'cbEvents', 6 v-bind:request-options = "reqopts", 7 v-on:onAdd = "onAddItem") 8 span(slot="label") 选择文件 9table 10 thead 11 tr 12 th name 13 th size 14 th progress 15 th status 16 th action 17 tbody 18 tr(v-for='file in files') 19 td(v-text='file.name') 20 td(v-text='file.size') 21 td(v-text='file.progress') 22 td(v-text='onStatus(file)') 23 td 24 button(type='button',@click="uploadItem(file)") 上传 25button(type='button',@click="uploadAll") 上传所有文件 26button(type='button',@click="clearAll") 清空文件列表 27</template> 28<script> 29import VueFileUpload from 'vue-file-upload'; 30export default{ 31 data(){ 32 return{ 33 files:[], 34 //文件过滤器,只能上传图片 35 filters:[ 36 { 37 name:"imageFilter", 38 fn(file){ 39 var type = '|' + file.type.slice(file.type.lastIndexOf('/') + 1) + '|'; 40 return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1; 41 } 42 } 43 ], 44 //回调函数绑定 45 cbEvents:{ 46 onCompleteUpload:(file,response,status,header)=>{ 47 console.log(file); 48 console.log("finish upload;") 49 } 50 }, 51 //xhr请求附带参数 52 reqopts:{ 53 formData:{ 54 tokens:'tttttttttttttt' 55 }, 56 responseType:'json', 57 withCredentials:false 58 } 59 } 60 }, 61 mounted(){ 62 //设置formData数据 63 this.$refs.vueFileUploader.setFormDataItem('authorization',"123"); 64 }, 65 methods:{ 66 onStatus(file){ 67 if(file.isSuccess){ 68 return "上传成功"; 69 }else if(file.isError){ 70 return "上传失败"; 71 }else if(file.isUploading){ 72 return "正在上传"; 73 }else{ 74 return "待上传"; 75 } 76 }, 77 onAddItem(files){ 78 console.log(files); 79 this.files = files; 80 }, 81 uploadItem(file){ 82 //单个文件上传 83 file.upload(); 84 }, 85 uploadAll(){ 86 //上传所有文件 87 this.$refs.vueFileUploader.uploadAll(); 88 }, 89 clearAll(){ 90 //清空所有文件 91 this.$refs.vueFileUploader.clearAll(); 92 } 93 }, 94 components:{ 95 VueFileUpload 96 } 97} 98</script>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 1/19 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
120 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More