当前位置:网站首页>Input file upload

Input file upload

2022-04-23 17:04:00 Eli-sun

	<div class="uploadexcel">
        <label for="fileInput">
          <span class="importBtn"> Import </span>
          <!-- <el-button type="primary"> Upload files </el-button> -->
        </label>
        <input
          v-show="false"
          type="file"
          id="fileInput"
          @change="handleFileUpload"
          accept=".xlsx"
          name="file"
          ref="file"
        />
    </div>
//script
//  Import 
const handleFileUpload = (e) => {
  console.log(' Import res', e);
  // console.log(' Import file', file);
  let file = e.target.files;
  let form = new FormData()
  form.append('xlsFile', e.target.files[0])
  console.log('99999-----', form.get("xlsFile"));
  importZbk(form).then(res => {
    console.log(res);
    e.target.value = ' ' //  When the imported files are the same, there will be a problem that they cannot be imported for the second time 
  })
}

版权声明
本文为[Eli-sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554289495.html