Commit 9c21be25 authored by Konstantin Azarov's avatar Konstantin Azarov Committed by baiyaaaaa

Ensure inner el-upload uses name attribute (#3940)

In order to avoid confusion when posting the form using regular non-xhr requests.
Also do not clear input value after `handleChange` event.
parent 190abd64
...@@ -59,7 +59,6 @@ export default { ...@@ -59,7 +59,6 @@ export default {
if (!files) return; if (!files) return;
this.uploadFiles(files); this.uploadFiles(files);
this.$refs.input.value = null;
}, },
uploadFiles(files) { uploadFiles(files) {
let postFiles = Array.prototype.slice.call(files); let postFiles = Array.prototype.slice.call(files);
...@@ -126,6 +125,7 @@ export default { ...@@ -126,6 +125,7 @@ export default {
let { let {
handleClick, handleClick,
drag, drag,
name,
handleChange, handleChange,
multiple, multiple,
accept, accept,
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
? <upload-dragger on-file={uploadFiles}>{this.$slots.default}</upload-dragger> ? <upload-dragger on-file={uploadFiles}>{this.$slots.default}</upload-dragger>
: this.$slots.default : this.$slots.default
} }
<input class="el-upload__input" type="file" ref="input" on-change={handleChange} multiple={multiple} accept={accept}></input> <input class="el-upload__input" type="file" ref="input" name={name} on-change={handleChange} multiple={multiple} accept={accept}></input>
</div> </div>
); );
} }
......
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