更新时间:2017/9/29 下午3:37:56
更新说明:
1. 优化图片和文件显示
2. 支持拖拽文件夹上传
vue上传demo,支持多选,拖拽上传
Build Setup
# install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report
随便在哪里加一个按钮,然后绑定下面这个方法,至于PHP代码随便框架都有批量上传文件
uploadImage: function() {
var data = new FormData();
for (var i = 0; i < this.imgList.length; i++) {
data.append("file", this.imgList[i].file);
}
$.ajax({
url: "/WorkOrder/upload",
type: 'POST',
data: data,
dataType: 'JSON',
cache: false,
processData: false,
contentType: false,
success: function(ret) {
console.log(ret);
}
});
}
你好 请问添加文件可以获取到图片的尺寸,长宽吗?
请问怎么用ajax提交 imgList 我用ajax 会显示错误
Array [ {…}, {…}, {…} ]test.html:175:13File.lastModifiedDate 已不赞成使用。请改用 File.lastModified。
回复