关于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. Web概念

    目录 Web概念概述 Web概念概述 JavaWeb 使用 Java 语言开发基于互联网的项目 软件架构 C / S:Client / Server 客户端 / 服务器端 在用户本地有一个客户端程序, ...

  2. Qt之分模块log

    说明 对于一般的log,使用 qInstallMessageHandler 重定向到文件即可,甚至可以根据日志等级,分类存储.但是并不是适用所有情况,比如,程序运行时动态创建模块,而每个模块需要创建不 ...

  3. 【Spark】这一篇或许能让你大概了解如何通过JavaAPI实现DataFrame的相关操作

    文章目录 需求概述 步骤 一.创建Maven工程并导包 二.选用第一种方法:利用反射机制配合样例类构建DataFrame 开发代码 选用第二种方法:通过StrucType配合Row构建DataFram ...

  4. 【Kafka】Kafka集群基础操作!新手上路必备~

    目录 bin目录 Topic命令概览 创建Topic 查看Topic 描述Topic Producer生产数据 Consumer消费数据 增加topic分区数 增加配置 删除配置 删除Topic 所有 ...

  5. spring源码解析--上

    本文是作者原创,版权归作者所有.若要转载,请注明出处. 首先是配置类 package com.lusai.config; import org.springframework.context.anno ...

  6. springboot启动报错:Handler dispatch failed; nested exception is java.lang.AbstractMethodError

    最近在用springboot构建项目,控制台报错:Handler dispatch failed; nested exception is java.lang.AbstractMethodError, ...

  7. Android ListView 代码1

    目录 ListView效果 一.ListView的简单用法 二.定制ListView的界面 目标 步骤 1.定义一个实体类作为ListView适配器的适配对象. 2.为ListView的子项指定我们的 ...

  8. centos下mysql 看不到mysql数据库(密码无法更改)

    1.这可能是因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,导致登录的时候是虽然用的是root,但实际是匿名登录的 2.解决方案 2.1.关闭mysql service mysql ...

  9. python爬虫-vmgirls-正则表达式

    概述 本次爬虫任务是爬取图片网站图片,网址是https://www.vmgirls.com/ 分析网页 第一步,打开需要爬取的页面https://www.vmgirls.com/13344.html ...

  10. RobotFramework自动化测试之元素定位

    前言:最近在做基于RF框架的Web自动化测试,其中涉及到元素的定位,主要用到id.name.xpath.css四中定位方法,尤其后面的两种方法特别有效,可以解决大部分的定位问题. id和name定位 ...