Html

<input id="file" type="file" accept=".map" onchange="upload()" />

JS

document.getElementById('file').value = null;

// document.getElementById('file').onchange = function () {
// alert(this.value);
// this.value = null;
// };​

Vue中

Html

<input ref="referenceUpload" @change="referenceUpload" type="file" accept=".map"  multiple/>

JS

  methods: {
referenceUpload(e) {
this.$refs.referenceUpload.value = null;
},
}

解决JS(Vue)input[type='file'] change事件无法上传相同文件的问题的更多相关文章

  1. salesforce零基础学习(八十九)使用 input type=file 以及RemoteAction方式上传附件

    在classic环境中,salesforce提供了<apex:inputFile>标签用来实现附件的上传以及内容获取.salesforce 零基础学习(二十四)解析csv格式内容中有类似的 ...

  2. <input type="file"> change事件异常处理办法

    问题:最近发现一个奇怪的bug, 那就是在上传图片需要采用input type=file来进行文件选择.由于为了适应美工的UI图,所以是把选择文件的input框隐藏了.然后通过另外一个按钮的点击事件来 ...

  3. input type=”file“ change事件只执行一次的问题

    js解决办法 HTML:<input id="file",type="file" onchange="upload()" /> ...

  4. 【原创】js中input type=file的一些问题

    1.介绍 在开发中,文件上传必不可少,input[type=file] 是常用的上传标签,但是它长得又丑.浏览的字样不能换,但是他长得到底有多丑呢.我们来看看在不同浏览器里的样子吧. <inpu ...

  5. js 实现 input type="file" 文件上传示例代码

    在开发中,文件上传必不可少但是它长得又丑.浏览的字样不能换,一般会让其隐藏点其他的标签(图片等)来时实现选择文件上传功能 在开发中,文件上传必不可少,<input type="file ...

  6. [置顶] js 实现 <input type="file" /> 文件上传

    在开发中,文件上传必不可少,<input type="file" /> 是常用的上传标签,但是它长得又丑.浏览的字样不能换,我们一般会用让,<input type ...

  7. vue项目中解决type=”file“ change事件只执行一次的问题

    问题描述 在最近的项目开发中遇到了这样的一个问题,当我上传了一个文件时,我将获取到的文件名清空后,却无法再次上传相同的文件 <template> <div class="h ...

  8. 谷歌游览器对<input type='file'> change只能响应1次解决和样式的改变

    在项目过程中遇到的需要上传本地文件,file的原始控件不太美观,但是这个控件和button有点不太一样, 改变这个样式的思路就是在控件外面套一层链接,然后把file控件的透明度设置为0(透明).样式只 ...

  9. js 清空 input[type=file]的值

    js 不能操作 input[type=file]但你可以将这个 input 的 dom 元素删除掉,再新增一个,或者替换掉 $("#UploadFile").replaceWith ...

随机推荐

  1. 35、concurrent.futures模块与协程

    concurrent.futures  —Launching parallel tasks    concurrent.futures模块同时提供了进程池和线程池,它是将来的使用趋势,同样我们之前学习 ...

  2. @RequestBody, @ResponseBody 注解详解(转)

    原文地址: https://www.cnblogs.com/qq78292959/p/3760651.html @RequestBody, @ResponseBody 注解详解(转) 引言: 接上一篇 ...

  3. vue项目启动时将localhost替换成指定ip地址

    1.node启动vue项目时地址一般都是http://localhost:8080 2.config->index.js 中的host:‘localhost’换成host:‘你的本机ip’就可以 ...

  4. 【放松一下】北美小游戏排行榜TOP10——“点击英雄”

    大家平时工作都比較忙,在这里推荐一款游戏让大家放松一下.让你体验到指数爆炸般挣钱的快感. 北美小游戏排行榜TOP10--"点击英雄" 简要说明: 游戏能够挂机,关闭电脑.游戏也会自 ...

  5. CentOS7配置防火墙

    使用命令的方式配置 ##Add firewall-cmd --permanent --zone=public --add-port=/tcp ##Remove firewall-cmd --perma ...

  6. 在 System.Web.Mvc.DefaultModelBinder.ConvertProviderRe

    在 System.Web.Mvc.ValueProviderResult.ConvertSimpleType(CultureInfo culture, Object value, Type desti ...

  7. http://www.360doc.com/userhome.aspx?userid=5054188&cid=235

    http://www.360doc.com/userhome.aspx?userid=5054188&cid=235

  8. 【Zend Studio】在Zend Studio中调试ThinkPhp框架

    在这篇文章中,笔者将会展示如何在Zend Studio下进行断点调试Think PHP.环境:windows 7.wampServer 3.1.4 64bit.zend studio 13.6.1Th ...

  9. Mac Node.js 配置

    1.Node.js 简介 Node.js® 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,可方便地构建快速,可扩展的网络应用程序的平台.Node.js 使用事件驱动,非阻塞式 ...

  10. 【转载】浅谈事件冒泡与事件捕获 - javascript 事件代理

    原文:https://segmentfault.com/a/1190000000749838 事件冒泡与事件捕获 事件冒泡和事件捕获分别由微软和网景公司提出,这两个概念都是为了解决页面中事件流(事件发 ...