安卓 微信 input file change無效 調試


最近公司在做一個活動需要做一個網站,還需要移動端能訪問。

有個上傳圖片的功能在andriod微信里面沒有反應,而在QQ和普通瀏覽器都是正常的。

頓時就無語了,想着手機web怎么調試呢?於是在網上找到了AlloyLever(http://alloyteam.github.io/AlloyLever/)。

一、alloylever的安裝和使用

1、alloylever安裝

npm install alloylever

2、引入alloy-leve.js

<script src="/themes/js/alloy-leve.js"></script>

3、添加配置

<script>

AlloyLever.config({
        cdn:'//s.url.cn/qqun/qun/qqweb/m/qun/confession/js/vconsole.min.js',
        reportUrl: "//a.qq.com",
        reportPrefix: 'abc',
        reportKey: 'msg',
        otherReport: {
            uin: 100000
        },
        entry:"#entry"
    })

</script>

//AlloyLever會監聽window.onerror並把錯誤信息保存下來,並且上報到reportUrl,你也可以召喚到vConsole並顯示出來錯誤和相關日志。


4、url喚起vConsole

只要你的頁面引用了AlloyLever,你只需要在你的url里帶上 vconsole=show 就能顯示vConsole面板。如:

http://localhost:63342/AlloyLever/index.html?vconsole=show

 

經過調試發現是input綁定的change事件無效。

<input id="fileImage" type="file" accept="image/*"/>

后經查詢需要加上capture="camera"屬性。

<input id="fileImage" type="file" accept="image/*;capture=camera"/>

經過測試,正常了!!!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM