用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: '',
shengfenzheng: '',
job: '',
mobile:

本文介绍了如何在Vue项目中实现Excel文件导入功能,通过HTML输入框选择文件,然后使用JavaScript进行Excel数据处理,最终调用接口将数据上传至后台数据库。
最低0.47元/天 解锁文章
3384

被折叠的 条评论
为什么被折叠?



