From afe975b3c2eb9fa313b348b38880fe77e8f117f6 Mon Sep 17 00:00:00 2001
From: Pan <panfree23@gmail.com>
Date: Fri, 30 Mar 2018 17:08:01 +0800
Subject: [PATCH] fix[UploadExcel]: fix can't select the same excel

---
 src/components/UploadExcel/index.vue | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/components/UploadExcel/index.vue b/src/components/UploadExcel/index.vue
index a1d56670..f17d8aed 100644
--- a/src/components/UploadExcel/index.vue
+++ b/src/components/UploadExcel/index.vue
@@ -1,6 +1,6 @@
 <template>
   <div>
-    <input id="excel-upload-input" type="file" accept=".xlsx, .xls" class="c-hide" @change="handkeFileChange">
+    <input id="excel-upload-input" ref="excel-upload-input" type="file" accept=".xlsx, .xls" class="c-hide" @change="handkeFileChange">
     <div id="drop" @drop="handleDrop" @dragover="handleDragover" @dragenter="handleDragover">
       Drop excel file here or
       <el-button style="margin-left:16px;" size="mini" type="primary" @click="handleUpload">browse</el-button>
@@ -51,7 +51,9 @@ export default {
     handkeFileChange(e) {
       const files = e.target.files
       const itemFile = files[0] // only use files[0]
+      if (!itemFile) return
       this.readerData(itemFile)
+      this.$refs['excel-upload-input'].value = null // fix can't select the same excel
     },
     readerData(itemFile) {
       const reader = new FileReader()
-- 
GitLab