关于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. D. Almost All Divisors(数学分解因子)

    其实这题并不难啊,但是分解因子的细节一定要小心. \(比如样例48,2是因子说明24也是因子,也就是说假如x存在\) \(那么x一定是因子中的最小数乘上最大数\) \(那我们现在去验证x是否存在,先拿 ...

  2. 【HBase】快速搞定HBase与Hive的对比、整合

    目录 对比 整合 需求一 步骤 一.将HBase的五个jar包拷贝到Hive的lib目录下 二.修改hive的配置文件 三.在Hive中建表 四.创建hive管理表与HBase映射 五.在HBase中 ...

  3. android实现计时器

    新建布局文件activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearL ...

  4. js 调用webservice及nigix解决跨域问题

    前言 我们写一些简单的爬虫的时候会遇到跨域问题,难道我们一定要用后台代理去解决吗? 答案是否定的.python之所以适应爬虫,是因为库真的很好用. 好吧python不是今天的主角,今天的主角是js. ...

  5. python语法学习第五天--lambda表达式、filter()、map()

    lambda表达式 python使用lamda表达式来创建匿名函数 lambda 函数拥有自己的命名空间,且不能访问自己参数列表之外或全局命名空间里的参数 语法: lambda [arg1 [,arg ...

  6. 推荐一款 python 管理工具:anaconda

    1.jpg 2.jpg 3.jpg 4.jpg 5.jpg 6.jpg 7.jpg 8.jpg 9.jpg 10.jpg 11.jpg 12.jpg 13.jpg 14.jpg 15.jpg 16.j ...

  7. layui的layer.msg,form提交

    layer.msg('提示文字',{shift:1,time:2000},function(){ location.reload();});其中shift是提示框的动画样式,-1为无动画form.on ...

  8. Rabbitmq 整合Spring,SpringBoot与Docker

    SpringBootLearning是对Springboot与其他框架学习与研究项目,是根据实际项目的形式对进行配置与处理,欢迎star与fork. [oschina 地址] http://git.o ...

  9. docker 使用 Nvidia 显卡

    docker19.03读取NVIDIA显卡 作者: 张首富 时间: 2019-09-06 w x: y18163201 前言 2019年7月的docker 19.03已经正式发布了,这次发布对我来说有 ...

  10. 你了解C#的协变和逆变吗

    从C# 4.0开始,泛型接口和泛型委托都支持协变和逆变,由于历史原因,数组也支持协变. 里氏替换原则:任何基类可以出现的地方,子类一定可以出现. 协变(out) 协变:即自然的变化,遵循里氏替换原则, ...