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.
pull/4080/head
Konstantin Azarov 2017-04-07 23:37:05 -04:00 committed by baiyaaaaa
parent 190abd647b
commit 9c21be25e7
1 changed files with 2 additions and 2 deletions

View File

@ -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 {
let { let {
handleClick, handleClick,
drag, drag,
name,
handleChange, handleChange,
multiple, multiple,
accept, accept,
@ -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>
); );
} }