当前位置:网站首页>El upload realizes the preview of uploaded files
El upload realizes the preview of uploaded files
2022-07-23 22:07:00 【Starry sky】
Element Official website el-upload File upload component , But there is no relevant function of file preview , However, sometimes the requirements need to meet the function of previewing after uploading files , So how to realize the right el-upload Preview the uploaded file ?
el-upload Component application
<el-upload class="upload-demo" ref="uploadFile" :auto-upload="false" :action="testForm.actionUrl" drag :file-list="testForm.fileList" :on-change="handleFileChange" :on-remove="removeFile" :limit="1" :on-exceed="overLimitCount" >
JS Function processing
handleFileChange(files, fileList) {
this.testForm.fileList = fileList
let reader = new FileReader()
reader.readAsText(files.raw)
reader.onload = e => {
this.testForm.fileContent = e.target.result.replace(
/\n|\r\n/g,
'<br/>'
)
}
},
Dialog Preview file
<el-button type="primary" @click="isShow = true" > File preview </el-button >
<el-dialog title=" File preview " :visible="isShow" @close="isShow = false" width="40%" append-to-body >
<div v-html="testForm.fileContent"></div>
</el-dialog>
边栏推荐
- Pulsar open source message queue_ Understand pulsar --- pulsar work notes 001
- Redis常用命令对应到Redisson对象操作
- lambda學習(sort後面的Comparator的使用,collection後使用Collectors.groupingBy分組)
- 为了一劳永逸而写的数独
- 机器学习习题——对率回归
- Programmer growth Article 26: how to hold a good daily morning meeting?
- Comparison of open source distributed link tracking
- 大学数据库创建与查询实战——数据库表设计
- Several methods of obtaining longitude and latitude by cesium
- 【数学建模暑期培训】配送中心选址问题
猜你喜欢

众邦科技又一潜心力作 —— 陀螺匠 OA 系统

多线程问题:为什么不应该使用多线程读写同一个socket连接?

MySQL索引事务

10道面试基础笔试题,你能对几题?

Apprentissage Lambda (utilisation du comparateur après tri, regroupement après collecte avec collectors.groupingby)

uniapp使用canvas写环形进度条

MySQL index transaction

记第一次挖洞交洞历程

Introduction to database system fifth edition after class exercises - Chapter 1 Introduction

Jedis 6 - Introduction and difference between redisson and jedis
随机推荐
Comment forcer complètement le meurtre de processus indépendants de l'arrière - plan?
Cesium core class viewer viewer details
MySQL索引事务
Jedis 6 - Introduction and difference between redisson and jedis
详解NAT技术
JS object array de duplication
Storage structure and management disk. It's a bit like installing Win98. You need to partition and format the hard disk first
Sudoku written for once and for all
JDBC programming of MySQL
STM32单片机使用ADC功能驱动手指检测心跳模块
Providers and consumers tags in zfoo
【AcWing】周赛
Golang invalid argument to intn报错的解决
el-select下拉框多选远程搜索反显
Cesium keyboard and mouse control camera roaming (source code + principle explanation)
Use of cjson Library
机器学习习题——对率回归
U++ 事件
[mathematical modeling summer training] location of distribution center
LeetCode高频题53. 最大子数组和,具有最大和的连续子数组,返回其最大和