Gathering detailed insights and metrics for vue-easy-uploader
Gathering detailed insights and metrics for vue-easy-uploader
Gathering detailed insights and metrics for vue-easy-uploader
Gathering detailed insights and metrics for vue-easy-uploader
prw-vue-easy-uploader
一个基于Vue的上传插件
aammui-uploader
Easy fileuploader for vue js
vue-anka-cropper
Easy to use image cropper and uploader component for Vue.js. Beta version.
easy-file-picker
Easy File Picker is a straightforward library with no dependencies to upload/pick/read files in the browser.
npm install vue-easy-uploader
Typescript
Module System
Node Version
NPM Version
JavaScript (71.63%)
Vue (27.45%)
HTML (0.93%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
92 Stars
10 Commits
31 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Jun 05, 2024
Latest Version
1.0.6
Package Id
vue-easy-uploader@1.0.6
Size
4.34 kB
NPM Version
5.0.3
Node Version
8.1.1
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
No dependencies detected.
一个基于Vue的移动端多文件上传插件,支持常见图片的上传。
1npm i vue-easy-uploader --save
在入口文件main.js
中加入以下代码:
1import Vue from 'vue' 2import Vuex from 'vuex' 3import uploader from 'vue-easy-uploader' 4 5let store = new Vuex.Store({}) 6Vue.use(uploader, store)
插件内部设置了状态管理,因此需要vuex的支持。
1<uploader 2 url="http://..." 3></uploader>
url: 上传接口路径
需要与后端约定上传格式,使用表单提交方式,后端需获取input[type='file']
的name
属性,默认为name="imgFiles[0]"
、name="imgFiles[1]"
...数组序号从0递增。
上传成功时返回的数据如下:
1<template> 2 <div> 3 <uploader 4 url="http://..." 5 ></uploader> 6 <div class="btn" @click="upload"> 7 上传 8 </div> 9 </div> 10</template> 11 12<script> 13import { mapState } from 'vuex' 14export default { 15 data () { 16 return { 17 imgs: [] 18 } 19 }, 20 computed: { 21 ...mapState({ 22 imgStatus: state => state.imgstore.img_status, 23 imgPaths: state => state.imgstore.img_paths 24 }) 25 }, 26 methods: { 27 upload () { 28 this.$store.commit('set_img_status', 'uploading') 29 }, 30 submit () { 31 let values = [] 32 for (let key of this.imgPaths) { 33 values.push(key) 34 } 35 this.imgs = values 36 console.log(this.imgs) 37 } 38 }, 39 watch: { 40 imgStatus () { 41 if (this.imgStatus === 'finished') { 42 this.submit() 43 } 44 } 45 }, 46 destoryed () { 47 this.imgs = [] 48 } 49} 50</script> 51 52<style scoped lang="less"> 53.btn { 54 width: 100%; 55 height: 3em; 56 background-color: green; 57 color: #fff; 58 display: flex; 59 justify-content: center; 60 align-items: center; 61} 62</style>
状态管理存储在state.imgstore中,包括:
1state.imgstore.img_upload_cache # 上传文件缓存 2state.imgstore.img_status # 上传状态,包括 ready selected uploading finished 3state.imgstore.img_paths # 上传后的路径反馈数组(数据结构为Set集合)
整个上传过程都通过img_status
判断,包括以下几个状态:
1ready # 上传开始前的准备状态 2selected # 已选择上传文件 3uploading # 开始上传 4finished # 上传完毕
1this.$store.commit('set_img_status', 'uploading')
只需要改变状态管理中的img_status
为uploading
即可。
1methods: { 2 submit () { 3 // some code 4 } 5} 6computed: { 7 ...mapState({ 8 imgStatus: state => state.imgstore.img_status 9 }) 10}, 11watch: { 12 imgStatus () { 13 if (this.imgStatus === 'finished') { 14 this.submit() 15 } 16 } 17}
监视state.imgstore.img_status
,当状态变为finished
时,执行文件上传完成后的回调。
详细的示例可访问本项目的 GitHub地址 。
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/10 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 SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
130 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