vue导入excel文件,vue导入多个sheets

本文介绍了如何在Vue项目中实现Excel文件导入功能,通过HTML输入框选择文件,然后使用JavaScript进行Excel数据处理,最终调用接口将数据上传至后台数据库。
摘要由CSDN通过智能技术生成

用input 导入 excel ,然后生成表格,然后调用接口上传到后台

html 导入按钮和选择文件的弹框

      <el-button v-waves :loading='downloadLoading' class='filter-item' type='primary' icon='el-icon-download' @click='daoru'>
        导入
      </el-button>
      <el-dialog title="导入文件" :visible.sync="excelImportShow">
        <a href="javascript:;" class="file">
          <input id="upload" type="file" @change="importfxx(this)" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
        </a>
        <div id="demo"></div>
        <div slot="footer" class="dialog-footer">
          <el-button @click.native="excelImportShow = false">取消</el-button>
          <el-button type="primary" @click.native="submit">提交</el-button>
        </div>
      </el-dialog>

js 重中之重 导入 excel 开始啦

1.data里面的数据

        excelImportShow: false,  //导入文件的弹框
        uploadArr: [],   // 上传给后台的数据
        realname: '',  // 以下都是我要转换的数据,因人而异
        gender: '',
        age: '',
        minzu: '',
        wenhua: '',
        
  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值