From a969e16bc07a4cd0a5e865dfea99aeaff3e3a9dc Mon Sep 17 00:00:00 2001 From: lianyue Date: Wed, 26 Sep 2018 18:11:29 +0800 Subject: [PATCH] fix #219 --- src/FileUpload.vue | 4 ++++ src/InputFile.vue | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/FileUpload.vue b/src/FileUpload.vue index 61b34f0..8da15bd 100644 --- a/src/FileUpload.vue +++ b/src/FileUpload.vue @@ -13,6 +13,8 @@ display: inline-block; } .file-uploads.file-uploads-html4 input[type="file"], .file-uploads.file-uploads-html5 label { + /* background fix ie click */ + background: #fff; opacity: 0; font-size: 20em; z-index: 1; @@ -25,6 +27,8 @@ height: 100%; } .file-uploads.file-uploads-html5 input[type="file"], .file-uploads.file-uploads-html4 label { + /* background fix ie click */ + background: rgba(255, 255, 255, 0); overflow: hidden; position: fixed; width: 1px; diff --git a/src/InputFile.vue b/src/InputFile.vue index f854f8f..08c8487 100644 --- a/src/InputFile.vue +++ b/src/InputFile.vue @@ -15,13 +15,17 @@ export default { methods: { change(e) { - this.$destroy() this.$parent.addInputFile(e.target) - // eslint-disable-next-line - new this.constructor({ - parent: this.$parent, - el: this.$el, - }) + e.target.value = '' + if (!e.target.files) { + // ie9 fix #219 + this.$destroy() + // eslint-disable-next-line + new this.constructor({ + parent: this.$parent, + el: this.$el, + }) + } } } }