<!-- 文件上传 -->
<template>
<section class="file-upload">
<p class="title">提案信息</p>
<el-upload
class="upload-demo"
ref="fileUpload"
accept=".xls,.xlsx"
:class="{'pointer-events' : fileShow}"
:action="action"
:data="excelPath"
:on-change="fileData"
:on-success="fileSuccess"
:show-file-list="fileShow"
:limit="1"
:file-list="fileList"
:before-remove="beforeRemove"
:disabled="disabled"
:auto-upload="false"
>
<el-button :type=" disabled ? 'info' : 'primary'" >导入发起提案</el-button> </el-upload> </section>
</template> <script> export default {
data() {
return {
action: process.env.VUE_APP_BASE_API + process.env.VUE_APP_REQURL +"/fileImport/getFileInfo",
excelPath: {
"excelPath": ""
}
};
},
computed:{
fileShow : {
get : function () {
return this.fileList.length > 0 ? true : false
},
set : function (newValue) { }
},
disabled : {
get : function () {
return this.$route.query.id ? true : false
},
set : function (newValue) { }
},
},
props:{
fileList: Array,Object,
}, methods: { beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`).then(()=>{
this.$emit('dataInit')
});
},
fileSuccess (response, file, fileList) {
this.getData(response.data)
this.fileShow = true
this.disabled = true
this.$emit('addFile',{name: file.name, url: ''})
}, getData(val){
this.$emit('getData',val)
},
// 获取本地路径地址
fileData(file){
let reader = new FileReader()
reader.readAsDataURL(file.raw);// 这里也可以直接写参数event.raw
reader.onload=()=>{
this.excelPath.excelPath = reader.result
this.$refs.fileUpload.submit(); }
}, }
}
</script>

  

element upload上传前对文件专门bs64上传的更多相关文章

  1. .NET 客户端上传本地excel文件到服务器上,并在客户端显示

    // 上传按钮 protected void btnUp_Click(object sender, EventArgs e) { bool b = Upload(fuExcel); // 上传exce ...

  2. Uploadify 上传后的文件删除,上传队列无法更新问题

    1. 定义一个上传限制数量 var uploadLimit = 3; 2. 点击页面的删除图片成功后,将uploadLimit++操作 3. 通过uploadify的settings方式重置上传限制数 ...

  3. SpringMVC结合ajaxfileupload.js实现文件无刷新上传

    直接看代码吧,注释都在里面 首先是web.xml <?xml version="1.0" encoding="UTF-8"?> <web-ap ...

  4. WEB版一次选择多个文件进行批量上传(WebUploader)的解决方案

    本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...

  5. JS开发——文件夹的上传和下载

    文件夹上传:从前端到后端 文件上传是 Web 开发肯定会碰到的问题,而文件夹上传则更加难缠.网上关于文件夹上传的资料多集中在前端,缺少对于后端的关注,然后讲某个后端框架文件上传的文章又不会涉及文件夹. ...

  6. B/S开发——文件夹的上传和下载

    本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...

  7. 前端js webuploader上传(导入)excel文件

    项目开发中用到导入(上传)Excel文件 我使用的是百度的webuploader: 1:下载:http://fex.baidu.com/webuploader/(官方下载/示例) 2:使用Web Up ...

  8. 将文件夹上传到FTP服务器,遍历上传,,,文件夹不能直接上传到FTP服务器上。。。

    <? $ftp_ip = "FTP"; $ftp_user = "user"; $ftp_pwd = "password"; $con ...

  9. ng-file-upload(在单文件选择,并且通过点击“上传”按钮上传文件的情况下,如何在真正选择文件之前保留上一文件信息?)

    文章前面研究ng-file-upload可能涉及指令: You can use ng-model or ngf-change instead of specifying function for ng ...

随机推荐

  1. Aliyun mysql配置 远程访问 10038

    环境 centos7.2    mysql5.7 网上搜了好多的文章,有的说在/etc/my.cnf 注释掉bind-address = 127.0.0.1 ,也开启了3306端口的防火墙,也添加了远 ...

  2. php json_encode的问题

    问题:跨域调用信息,返回json格式数据,返回的json数据中会多出空格,导致再用json_decode()编码的时候,页面显示空白,编码失败.解决方法:在页面中加入ob_end_clean();解决 ...

  3. linux crontab 执行任务(7秒执行)

    创建的contab 文件中,每一行都代表一项任务,每行的每个字段代表一项设置.前五个字段是时间,第六个字段是要执行的命令 minute   hour   day   month   week   co ...

  4. 网络流强化-POJ2516

    k种货物分开求解最小费用最大流,主要减少了寻找最短路的时间. #include<queue> #include<cstdio> #include<cstring> ...

  5. 学习:多项式算法----FFT

    FFT,即快速傅里叶变换,是离散傅里叶变换的快速方法,可以在很低复杂度内解决多项式乘积的问题(两个序列的卷积) 卷积 卷积通俗来说就一个公式(本人觉得卷积不重要) $$C_k=\sum_{i+j=k} ...

  6. JavaScript LinkedList

    function LinkedList() { var Node = function(element) { this.element = element; this.next = null } va ...

  7. Windows下通过GitHub+Hexo搭建个人博客的步骤

    Windows下通过GitHub+Hexo搭建个人博客的步骤  https://blog.csdn.net/namechenfl/article/details/90442312 https://bl ...

  8. Python入门之基础day1

    一.引子 1. 什么是编程语言? 编程语言就是人与计算机沟通的介质 2.什么是编程? 编程就是人把自己想命令计算机干的事情通过编程语言翻译出来并写到文件里去 为什么要编程? 编程的目的就是为了让计算机 ...

  9. /dev/random vs /dev/urandom

    If you want random data in a Linux/Unix type OS, the standard way to do so is to use /dev/random or ...

  10. Topcoder SRM652div2

    开始接触Topcode..div2.. 250题目: Problem Statement      You are given a String s consisting of lower to , ...