csv文件上传
链接:
https://blog.csdn.net/weixin_44481476/article/details/108296932
https://blog.csdn.net/qq_36597079/article/details/86612667
等等,好多链接都一样内容
。。。。
<el-upload
ref="upload"
class="upload-demo"
drag
action
:multiple="false"
:limit="1"
:auto-upload="false"
>
<!-- :on-change="handleFileChange" -->
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>选择文件</em></div>
<div slot="tip" class="el-upload__tip">只能上传.csv文件</div>
</el-upload>
<el-button size="small" type="primary" style="margin-left: 10px;" @click="handleFileChange()">上传</el-button>
<script>
export default {
data(){
return {
sysAppIds: 'xxxxxxxxxxxsx'
}
},
methods: {
/**
* 上传
*/
async handleFileChange(uploadType) {
// console.log('file',file)
const file = this.$refs.upload.uploadFiles[0]
this.fileTemp = file.raw;
if (this.fileTemp) {
if (
this.fileTemp.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
this.fileTemp.type == 'application/vnd.ms-excel'
) {
await this.importfxx(this.fileTemp,uploadType);