关于vue+element对ie9的兼容el-upload不支持在IE9上传

https://lian-yue.github.io/vue-upload-component/#/zh-cn/

解决方案 采用vue-upload-component

npm install vue-upload-component --save
<template>
<div class="app-container">
<el-row class="page-content">
<el-col :span="24" style="margin:20px">
<el-form label-width="200px" class="addform"> <el-form-item label="附件">
<file-upload
class="el-button margin_left10 el-button--primary el-button--small"
style="overflow:visible"
:maximum="1"
:multiple="false"
  ref="upload"
  v-model="files"
  post-action="url"
  @input-file="inputFile"
  @input-filter="inputFilter"
>
<span style="color:#FFFFFF">选取文件</span>
</file-upload>
<el-button
size="small"
type="primary"
v-show="!$refs.upload || !$refs.upload.active"
@click.prevent="$refs.upload.active = true"
>
<span style="color:#FFFFFF">开始上传</span>
</el-button>
</el-form-item>
<el-form-item label="文件列表" class="fileList" v-show=" files.length>0">
<ul class="el-upload-list el-upload-list--text">
<li class="el-upload-list__item is-ready" v-for="(file,index) in files" :key="index">
<span>{{file.name}}</span>
</li>
</ul>
</el-form-item>
</el-form> </el-col>
</el-row>
</div>
</template>
<script>
import { getFileId, deleteFileId } from "@/api/flca";
import "vue-upload-component/dist/vue-upload-component.part.css";
import FileUpload from "vue-upload-component";
export default {
components: {
FileUpload
},
data() {
return {
files: [],
};
},
methods: {
upLoad() {
this.$refs.upload.active = true;
},
inputFilter(newFile, oldFile, prevent) {
if (newFile && !oldFile) {
const extension = newFile.name.substring(newFile.name.lastIndexOf(".") + 1);
console.log(extension);
if (extension =='pdf' ||extension =='PDF' ) { } else {
this.$message({
message: "上传文件只能是pdf格式文件!",
type: "warning"
});
return prevent();
}
}
},
inputFile(newFile, oldFile) {
if (newFile && oldFile) {
// 更新文件 // 开始上传
if (newFile.active !== oldFile.active) {
console.log("Start uploa3333333333333333d",newFile.size)
console.log("Start upload", newFile.active, newFile);
this.isXls = false;
} // 上传进度
if (newFile.progress !== oldFile.progress) {
console.log("progress", newFile.progress, newFile);
} // 上传错误
if (newFile.error !== oldFile.error) {
console.log("error", newFile.error, newFile);
this.$message({ message: "上传失败!", type: "error" });
} // 上传成功
if (newFile.success !== oldFile.success) {
console.log("success", newFile.success, newFile);
this.$message({ message: "上传成功!", type: "success" });
}
}
}
}
};
</script>

关于vue+element对ie9的兼容el-upload不支持在IE9上传的更多相关文章

  1. vue项目内嵌入到app input type=file 坑(文件上传插件)

    w问题描述: 我用vue-cli完成的一个移动端项目,内嵌到app当中,用原生的input type=file 来完成文件上传.在安卓下没有问题但是在苹果手机 上传第二次手机就会发生白屏 并无缘无故跳 ...

  2. 【转载】兼容php5,php7的cURL文件上传示例

    转载来自: http://www.huanlinna.com/2016/06/25/coding/php5-php7-upload-demo-via-curl.html https://segment ...

  3. FormData兼容IE10 360及DWR的异步上传原理

    摘自:https://github.com/henryluki/FormData/blob/master/formdata.js if(!window.FormData) { (function(se ...

  4. VUE项目中文件上传兼容IE9

    项目使用VUE编写,UI是ElementUI,但是Element的Upload组件是不兼容IE9的.因为IE9中无法使用FormData. 查找资料基本有两种解决方法:1.引入JQuery和jQuer ...

  5. 封装Vue Element的upload上传组件

    本来昨天就想分享封装的这个upload组件,结果刚写了两句话,就被边上的同事给偷窥上了,于是在我全神贯注地写分享的时候他就神不知鬼不觉地突然移动到我身边,腆着脸问我在干啥呢.卧槽你妈,当场就把我吓了一 ...

  6. axios+Vue上传文件显示进度

    一,前言 最近在用Vue,然后上传文件时需要显示进度,于是网上搜了一下,经过自己实测终于也弄明白了 二,效果 三,代码 HTML代码 <div id="app"> &l ...

  7. springBoot+ vue+ Element-ui实现合并多图上传(一次请求多张图片)

    这次上传使用的是Elemet-ui的uoload上传组件,组件预留的钩子回调还是比较充足的. 1:  实现多图上传主要用到以下两个属性: 下面讲一下属性使用: <el-upload :actio ...

  8. vue+axios实现移动端图片上传

    在利用vue做一些H5页面时,或多或少会遇到有图片上传的操作,主要是运用html5里面的input[type=file]来实现,传递到后端的数据是以二进制的格式传递,所以上传图片的请求与普通的请求稍微 ...

  9. vue图片上传组件

    前言:很多项目中都需要用到图片上传功能,而其多处使用的要求,为了避免重复造轮子,让我决定花费一些时间去深入了解,最终封装了一个vue的图片上传组件.现将总结再次,希望有帮助. Layout <d ...

  10. element中文件上传

    vue+element 文件操作 作者:一粒尘土 时间:2019-3-17 注:以下操作针对 vue-cli 目录 使用 组件常用参数 组件常用方法 上传文件 上传文件格式限制 回显文件 下载文件 删 ...

随机推荐

  1. P2309(逆序对)

    传送门 描述:给定一个序列长n,求多少子串和大于零. \(一开始一定会想到根据前缀和优化,枚举起点和中点O(n)解决\) \(那更高效的方法呢?实际上,我们上面就是要求S_i-S_j>0的数量\ ...

  2. Linux(Ubuntu) MySQL数据库安装与卸载

    安装 修改远程访问 卸载 安装 首先检查系统中是否已经安装了MySQL sudo netstat -tap | grep mysql 没有显示已安装结果,则没有安装 如若已安装,可以选择删除.(删除方 ...

  3. python gdal 读取栅格数据

    1.gdal包简介 gdal是空间数据处理的开源包,其支持超过100种栅格数据类型,涵盖所有主流GIS与RS数据格式,包括Arc/Info ASCII Grid(asc),GeoTiff (tiff) ...

  4. 导出jar包和api文档

    导出jar包过程 右击项目名称->export 选择java->JAR file next->选择路径 导出成功 生成api文档 选择doc->右键export java-&g ...

  5. C# 数据操作系列 - 6 EF Core 配置映射关系

    0. 前言 在<C# 数据操作系列 - 5. EF Core 入门>篇中,我们简单的通过两个类演示了一下EF增删改查等功能.细心的小伙伴可能看了生成的DDL SQL 语句,在里面发现了些端 ...

  6. Springboot中修改.properties文件为.yml文件时项目不能运行问题

    可能很多小伙伴会考虑环境配置的问题,maven版本.idea版本什么的,其实没有必要 只要你之前.ies时能运行,那么环境配置就没有问题 不能运行的原因,一定是你的.yml文件的格式问题 .yml文件 ...

  7. springMVC 重定向带参数

    重定向时经常需要带上一定的标志位参数,当然,强大的springmvc提供了便利的操作. 只需要在方法参数中添加RedirectAttributes 或其子类即可! @RequestMapping(&q ...

  8. 实现es6中的set和map

    转载自: https://www.cnblogs.com/hui-fly/p/9459152.html https://blog.csdn.net/roamingcode/article/detail ...

  9. Apache自定义404

    先用命令找到httpd.conf文件在哪 find -name 'httpd.conf' 默认配置文件: vim /etc/httpd/conf/httpd.conf 然后找到项目的路径 <Di ...

  10. ES6常见面试题

    1.es5和es6的区别,说一下你所知道的es6 ECMAScript5,即ES5,是ECMAScript的第五次修订,于2009年完成标准化 ECMAScript6,即ES6,是ECMAScript ...