webview中input type="file"安卓手机相册选择图片不触发onchange?求解决
[图片]相册内进入选择图片,不触发onchange事件,小米11,华为mate50,华为nova8 pro 都试了不行,在浏览器中可以触发onchagne事件。最近图片或者进入文件管理里面选择图片可以触发onchange的。 链接:https://dev.xinhulu.com/komaTest/arthuraaa.html 代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script> </head> <body> <div class="btn">btttnnn</div> <script> var vConsole = new window.VConsole(); const btn = document.querySelector('.btn') btn.addEventListener('click',(e) => { var fileInput = document.createElement('input') fileInput.type = 'file' fileInput.style.display = 'none' fileInput.addEventListener('change', function () { console.log(this.files,'files') }, false) fileInput.setAttribute('multiple', 'multiple') document.body.appendChild(fileInput) fileInput.click() }) </script> </body> </html> 如果触发onchange事件,vconsole控制台会有打印的。