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

时间:2019-05-23 15:05:25   收藏:0   阅读:591

一般的解决方法

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;
    },
}

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!