element upload上传前对文件专门bs64上传
<!-- 文件上传 -->
<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上传的更多相关文章
- .NET 客户端上传本地excel文件到服务器上,并在客户端显示
// 上传按钮 protected void btnUp_Click(object sender, EventArgs e) { bool b = Upload(fuExcel); // 上传exce ...
- Uploadify 上传后的文件删除,上传队列无法更新问题
1. 定义一个上传限制数量 var uploadLimit = 3; 2. 点击页面的删除图片成功后,将uploadLimit++操作 3. 通过uploadify的settings方式重置上传限制数 ...
- SpringMVC结合ajaxfileupload.js实现文件无刷新上传
直接看代码吧,注释都在里面 首先是web.xml <?xml version="1.0" encoding="UTF-8"?> <web-ap ...
- WEB版一次选择多个文件进行批量上传(WebUploader)的解决方案
本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...
- JS开发——文件夹的上传和下载
文件夹上传:从前端到后端 文件上传是 Web 开发肯定会碰到的问题,而文件夹上传则更加难缠.网上关于文件夹上传的资料多集中在前端,缺少对于后端的关注,然后讲某个后端框架文件上传的文章又不会涉及文件夹. ...
- B/S开发——文件夹的上传和下载
本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...
- 前端js webuploader上传(导入)excel文件
项目开发中用到导入(上传)Excel文件 我使用的是百度的webuploader: 1:下载:http://fex.baidu.com/webuploader/(官方下载/示例) 2:使用Web Up ...
- 将文件夹上传到FTP服务器,遍历上传,,,文件夹不能直接上传到FTP服务器上。。。
<? $ftp_ip = "FTP"; $ftp_user = "user"; $ftp_pwd = "password"; $con ...
- ng-file-upload(在单文件选择,并且通过点击“上传”按钮上传文件的情况下,如何在真正选择文件之前保留上一文件信息?)
文章前面研究ng-file-upload可能涉及指令: You can use ng-model or ngf-change instead of specifying function for ng ...
随机推荐
- SSH 的原理和实践
最近自己在学习使用SSH,现将自己理解的SSH原理和实践SSH的操作写成一篇博客,以供日后查看. 一.SSH是什么?为什么会出现SSH? SSH英文全称是Secure Shell,即安全外壳.首先SS ...
- php脚本超时时间设置
设置PHP脚本执行超时的时间有下面这样一些方法:php.ini 中缺省的最长执行时间是 30 秒,这是由 php.ini 中的 max_execution_time 变量指定,倘若你有一个需要颇多时间 ...
- HTML--JS 随机背景色
<html> <head> <title>背景随机变色</title> <script type="text/javascript&qu ...
- 安卓中java和js如何交互
1.安卓中java和js如何交互 在Android上怎样实现JAVA和JS交互呢?Android的webview是基于webkit内核的,webview中集成了js与java互调的接口函数,通过add ...
- Effect Hook
1 数据获取,设置订阅以及手动更改 React 组件中的 DOM 都属于副作用. 2 可以把 useEffect Hook 看做 componentDidMount,componentDidUpdat ...
- sourcetree for mac 使用
1.sourceTree clone 仓库 打开sourceTree, 点击 新仓库(1) -> 从url克隆(2), 如下图 如下图所示, 粘贴源url路径, 自动补全或者手动选择目标路径和名 ...
- 自定义InputFormat
回顾: 在上一篇https://www.cnblogs.com/superlsj/p/11857691.html详细介绍了InputFormat的原理和常见的实现类.总结来说,一个InputForma ...
- ansiable介绍及安装
ansible介绍: Ansible默认通过 SSH 协议管理机器. ssh协议介绍:https://www.cnblogs.com/yaozhiqiang/p/9944894.html 安装ansi ...
- RabbitMQ ——与Spring集成及exchange的direct、topic方式实现和简单队列实现
程序整体结构 Maven依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http: ...
- elasticsearch 基础 —— Query String
使用查询解析器来解析其内容的查询.下面是一个例子: GET /_search { "query": { "query_string" : { "def ...