关于vue+element对ie9的兼容el-upload不支持在IE9上传
关于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上传的更多相关文章
- vue项目内嵌入到app input type=file 坑(文件上传插件)
w问题描述: 我用vue-cli完成的一个移动端项目,内嵌到app当中,用原生的input type=file 来完成文件上传.在安卓下没有问题但是在苹果手机 上传第二次手机就会发生白屏 并无缘无故跳 ...
- 【转载】兼容php5,php7的cURL文件上传示例
转载来自: http://www.huanlinna.com/2016/06/25/coding/php5-php7-upload-demo-via-curl.html https://segment ...
- FormData兼容IE10 360及DWR的异步上传原理
摘自:https://github.com/henryluki/FormData/blob/master/formdata.js if(!window.FormData) { (function(se ...
- VUE项目中文件上传兼容IE9
项目使用VUE编写,UI是ElementUI,但是Element的Upload组件是不兼容IE9的.因为IE9中无法使用FormData. 查找资料基本有两种解决方法:1.引入JQuery和jQuer ...
- 封装Vue Element的upload上传组件
本来昨天就想分享封装的这个upload组件,结果刚写了两句话,就被边上的同事给偷窥上了,于是在我全神贯注地写分享的时候他就神不知鬼不觉地突然移动到我身边,腆着脸问我在干啥呢.卧槽你妈,当场就把我吓了一 ...
- axios+Vue上传文件显示进度
一,前言 最近在用Vue,然后上传文件时需要显示进度,于是网上搜了一下,经过自己实测终于也弄明白了 二,效果 三,代码 HTML代码 <div id="app"> &l ...
- springBoot+ vue+ Element-ui实现合并多图上传(一次请求多张图片)
这次上传使用的是Elemet-ui的uoload上传组件,组件预留的钩子回调还是比较充足的. 1: 实现多图上传主要用到以下两个属性: 下面讲一下属性使用: <el-upload :actio ...
- vue+axios实现移动端图片上传
在利用vue做一些H5页面时,或多或少会遇到有图片上传的操作,主要是运用html5里面的input[type=file]来实现,传递到后端的数据是以二进制的格式传递,所以上传图片的请求与普通的请求稍微 ...
- vue图片上传组件
前言:很多项目中都需要用到图片上传功能,而其多处使用的要求,为了避免重复造轮子,让我决定花费一些时间去深入了解,最终封装了一个vue的图片上传组件.现将总结再次,希望有帮助. Layout <d ...
- element中文件上传
vue+element 文件操作 作者:一粒尘土 时间:2019-3-17 注:以下操作针对 vue-cli 目录 使用 组件常用参数 组件常用方法 上传文件 上传文件格式限制 回显文件 下载文件 删 ...
随机推荐
- B - Lawrence HDU - 2829 斜率dp dp转移方程不好写
B - Lawrence HDU - 2829 这个题目我觉得很难,难在这个dp方程不会写. 看了网上的题解,看了很久才理解这个dp转移方程 dp[i][j] 表示前面1~j 位并且以 j 结尾分成了 ...
- Django 配置JWT认证方式
1. 安装 rest_framework + djangorestframework_simplejwt 安装djangorestframework_simplejwt :pip install dj ...
- learn from collection framework design
最难忍受的痛苦,也许是想干一件事情而又不去干.--罗曼·罗兰 前言 本篇文章算是拾人牙慧吧,偶尔谷歌到一个能很好把collection framework design讲好的文档,一是为了总结提升,也 ...
- 环境篇:Kylin3.0.1集成CDH6.2.0
环境篇:Kylin3.0.1集成CDH6.2.0 Kylin是什么? Apache Kylin™是一个开源的.分布式的分析型数据仓库,提供Hadoop/Spark 之上的 SQL 查询接口及多维分析( ...
- Ubuntu1804 源码阅读神器,egypt+graphviz 图形化显示函数调用关系(超详细+图文并茂)
函数调用图可以让我们更加直观地了解到源码函数直接的调用和层次关系,提高阅读源码的效率,工欲善其事,必先利其器: 文章目录 1 前言 2 graphviz 安装 3 egypt 安装 4 测试 5 结论 ...
- Python内置函数列表
函数 用途 abs() 返回数字绝对值 all() 判断给定的可迭代参数 iterable 中的所有元素是否都为 TRUE,如果是返回 True,否则返回 False any() 判断给定的可迭代参数 ...
- Codeforces Round #643 (Div.2)
前言:这套cf我感觉出的很不错,AB就不说了,唯一有点欠缺的就是C和D的位置应该换一下,C出的挺不错,反正我当时没有想出来(赛后补题的时候其实也不难..听朋友说还可以FFT优化,然而我是个图论手并不会 ...
- ESXI 6.5利用Centos7重置root密码
ESXI6.5宿主机,很久没有登录,再次登录的时候,发现忘记root密码了 1.先将刻录一个CentOS7的启动光盘或U盘,并将服务器的启动项修改为光盘 2.保存BIOS重启后,选择Troublesh ...
- zsy后台管理系统-界面
自研平台:(java+vue+mysql+docker) 欢迎大家预览,指导! http://www.zsyai.top/dist 流程引擎 自定义定时任务: 一键生成前后端代码:
- mysqldump 参数--single-transaction
其实很简单,single-transaction可以让mysqldump 的时候不锁表.但是他有3个前提 innodb的引擎 不能在执行的同时,有其他alter table ,drop table,r ...