首页 > Web开发 > 详细

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

时间:2019-05-23 15:05:25      阅读:591      评论:0      收藏:0      [点我收藏+]

一般的解决方法

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事件无法上传相同文件的问题

原文:https://www.cnblogs.com/hdff/p/10911903.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!