安卓 微信 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"/>

经过测试,正常了!!!

 
原文地址:https://www.cnblogs.com/java-chanjuan/p/8038296.html