微信浏览器在VIVO IQOO 对input file 无法触发change事件
<input type="file" > <div class="add_img"> 上传图片 <input type="file" id="addFile" onchange="getAddImg('addFile')"> </div> <div id="add_msg" style="100%"> <img id="img" src="" alt=""> </div> <script type="text/javascript"> function getAddImg(obj){ alert("asdasd") let docObj = document.getElementById(obj); let img = document.getElementById("img"); let objMsg = document.getElementById("add_msg"); let file = docObj.files; console.log(file[0]) objMsg.append("<p>"+file[0].name+"</p>") if(file && file[0]){ let src = window.URL.createObjectURL(file[0]); img.src = src; }else{ } } </script>