您的位置:首页 > 产品设计 > UI/UE

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

2017-10-09 10:30 1086 查看

一般的解决方法

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;
},
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐