1.单文件上传

<template>
<div>
<label for="fileInput">
<i aria-hidden="true" class="cursor">上传文件</i>
</label>
<input
v-show="false"
type="file"
id="fileInput"
@change="handleFileChange"
name="file"
ref="file"
/>
</div>
</template> <script>
export default {
data() {
return {};
},
methods: {
handleFileChange(e) {
let _this = this;
let file = e.target.files;
console.log(file,"单文件流文件流");
}
}
};
</script> <style lang="scss" scoped>
.cursor {
cursor: pointer;
color: #409eff;
font-size: 16px;
}
</style>

2.多文件上传

在input上加属性 multiple="multiple"即可实现多文件上传,也可以设置文件上传类型是在input上加属性 accept=".xls, .xlsx"

<template>
<div>
<label for="fileInput">
<i aria-hidden="true" class="cursor">上传文件</i>
</label>
<input
v-show="false"
type="file"
id="fileInput"
@change="handleFileChange"
accept=".xls, .xlsx"
name="file"
ref="file"
multiple="multiple"
/>
</div>
</template> <script>
export default {
data() {
return {};
},
methods: {
handleFileChange(e) {
let _this = this;
let file = e.target.files;
console.log(file,"多文件文件流文件流");
}
}
};
</script> <style lang="scss" scoped>
.cursor {
cursor: pointer;
color: #409eff;
font-size: 16px;
}
</style>

最新文章

  1. MooseFs-分布式文件系统系列(二)之安装总结
  2. 深入JVM-java虚拟机的基本结构
  3. Gradle的配置实例
  4. Spring MVC 之请求处理方法可接收参数(三)
  5. DB other operation
  6. 解决nginx负载均衡的session共享问题
  7. [改善Java代码]让多重继承成为现实
  8. sql语句:if exists语句使用
  9. fastjson过滤不需要的属性
  10. (转)Mysql数据库存储引擎
  11. j2e应用相关技术
  12. 神经网络1_neuron network原理_python sklearn建模乳腺癌细胞分类器(推荐AAA)
  13. work-7.2
  14. HDU 1284(钱币兑换 背包/母函数)
  15. MySQL多实例部署与优化
  16. Android 监听手机GPS打开状态
  17. C++中const和指针
  18. Spring Security教程(一):初识Spring Security
  19. Android——程序员的情怀——优化BaseAdapter
  20. C#客户端嵌入Chrome浏览器的实现

热门文章

  1. 精尽Spring MVC源码分析 - HandlerAdapter 组件(四)之 HandlerMethodReturnValueHandler
  2. Python-其他-round()保留小数位时遇到的问题
  3. python 实现数值积分与画图
  4. Java基础-方法的重写和重载
  5. 使用Attribute限制Action只接受Ajax请求
  6. PPT技术干货1(下)——数据图表分析、逻辑梳理、高效办公
  7. (十四)、shell脚本之shell基础(上)
  8. .net core 和 WPF 开发升讯威在线客服与营销系统:系统总体架构
  9. MongoDb二
  10. 初始MQTT