来源: http://www.jq22.com/jquery-info15578
演示: http://www.jq22.com/yanshi15578
github: https://github.com/317482454/vue_upload/blob/master/src/components/Hello.vue
来看我修改:
代码:
父组件:
如何把上传的图片传给后台
https://www.jianshu.com/p/15ef3d1c14e7
获取input的file属性
https://segmentfault.com/q/1010000011657090
data(){
return :{
imgList: []
}
}
components: {
‘updatefile’: uploadImages
},
//提交函数里面这样获取
let picList = this.$refs.upload.imgList
console.log(picList)
uploadImages.vue
<input
@change=“fileChange($event)”
type=“file”
id=“upload_file”
multiple
style=“display: none”
{{item.file.name}}
<i class=“iconfont icon-chahao upload_warp_img_div_del” @click=“fileDel(index)”>
选中{{imgList.length}}个文件,共{{bytesToSize(this.size)}}