Commit 2db229c5 authored by linhuandong's avatar linhuandong

上传文件顺序

parent c925aa04
{"1.4.13":"1.4","2.0.11":"2.0","2.1.0":"2.1","2.2.2":"2.2","2.3.9":"2.3","2.4.11":"2.4","2.5.4":"2.5","2.6.3":"2.6","2.7.2":"2.7","2.8.2":"2.8","2.9.2":"2.9","2.10.1":"2.10","2.11.1":"2.11","2.12.0":"2.12","2.13.2":"2.13","2.14.1":"2.14","2.15.7680":"2.15"} {"1.4.13":"1.4","2.0.11":"2.0","2.1.0":"2.1","2.2.2":"2.2","2.3.9":"2.3","2.4.11":"2.4","2.5.4":"2.5","2.6.3":"2.6","2.7.2":"2.7","2.8.2":"2.8","2.9.2":"2.9","2.10.1":"2.10","2.11.1":"2.11","2.12.0":"2.12","2.13.2":"2.13","2.14.1":"2.14","2.15.7681":"2.15"}
\ No newline at end of file \ No newline at end of file
{ {
"name": "element-ui", "name": "element-ui",
"version": "2.15.7680", "version": "2.15.7681",
"description": "A Component Library for Vue.js.", "description": "A Component Library for Vue.js.",
"main": "lib/element-ui.common.js", "main": "lib/element-ui.common.js",
"files": [ "files": [
......
...@@ -53,6 +53,7 @@ export default function upload(option) { ...@@ -53,6 +53,7 @@ export default function upload(option) {
}); });
} }
formData.append('filename', option.filename); formData.append('filename', option.filename);
formData.append('fileindex', option.fileindex);
formData.append(option.name, option.file, option.file.name); formData.append(option.name, option.file, option.file.name);
......
...@@ -85,12 +85,21 @@ export default { ...@@ -85,12 +85,21 @@ export default {
this.$refs.input.value = null; this.$refs.input.value = null;
if (!this.beforeUpload) { if (!this.beforeUpload) {
let file = this.fileList.find(o => o.uid === rawFile.uid); let fileIndex = this.fileList.findIndex(o => o.uid === rawFile.uid);
let file = this.fileList[fileIndex];
let filename = file.name; let filename = file.name;
let orgSuffix = rawFile.name.substring(rawFile.name.lastIndexOf('.'));
if (filename.indexOf('.') === -1) { if (filename.indexOf('.') === -1) {
filename = file.name + rawFile.name.substring(rawFile.name.lastIndexOf('.')); // 不存在文件类型后缀,补充原文件后缀
filename = file.name + orgSuffix;
} else {
let suffix = filename.substring(filename.lastIndexOf('.'));
if (suffix !== orgSuffix) {
// 文件类型后缀不相同,再补充原文件后缀
filename = filename + orgSuffix;
}
} }
return this.post(rawFile, filename); return this.post(rawFile, filename, fileIndex);
} }
const before = this.beforeUpload(rawFile); const before = this.beforeUpload(rawFile);
...@@ -137,7 +146,7 @@ export default { ...@@ -137,7 +146,7 @@ export default {
}); });
} }
}, },
post(rawFile, filename) { post(rawFile, filename, fileindex) {
const { uid } = rawFile; const { uid } = rawFile;
const options = { const options = {
headers: this.headers, headers: this.headers,
...@@ -145,6 +154,7 @@ export default { ...@@ -145,6 +154,7 @@ export default {
file: rawFile, file: rawFile,
data: this.data, data: this.data,
filename: filename, filename: filename,
fileindex: fileindex,
name: this.name, name: this.name,
action: this.action, action: this.action,
onProgress: e => { onProgress: e => {
......
...@@ -210,7 +210,7 @@ if (typeof window !== 'undefined' && window.Vue) { ...@@ -210,7 +210,7 @@ if (typeof window !== 'undefined' && window.Vue) {
} }
export default { export default {
version: '2.15.7680', version: '2.15.7681',
locale: locale.use, locale: locale.use,
i18n: locale.i18n, i18n: locale.i18n,
install, install,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment