移动端网页调试面板.md 2.4 KB

##

放在应用程序代码之前运行

<!-- 测试环境-调试 -->
<script src="//unpkg.com/vconsole/dist/vconsole.min.js"></script>
<script>
  var vConsole = new VConsole();
</script>
<!-- 测试环境-调试 -->
<script src="//wx.palmnest.com/super_cloud/static/npm/vconsole/dist/vconsole.min.js"></script>
<script>
  new VConsole();
</script>
<% if (mode!=='development' ) { %>
<script>
  if (
    !/eruda=true/.test(window.location) &&
    localStorage.getItem("active-eruda") != "true"
  )
    return;
  document.write(
    '<script src="//fastly.jsdelivr.net/npm/vconsole/dist/vconsole.min.js"><\/script>'
  );
  document.write("<script>var vConsole = new VConsole();<\/script>");
</script>
<% } %>
;(function () {
    var src = '//cdn.jsdelivr.net/npm/eruda';
    if (!/eruda=true/.test(window.location) && localStorage.getItem('active-eruda') != 'true') return;
    document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
    document.write('<scr' + 'ipt>eruda.init();</scr' + 'ipt>');
})();

##

放在应用程序代码之前运行

<script>
  (/debug=true/.test(window.location) ||
    "true" == localStorage.getItem("active-eruda")) &&
    (document.write('<script src="//cdn.jsdelivr.net/npm/eruda"><\/script>'),
    document.write("<script>eruda.init();<\/script>"));
</script>
    <script>
        (function () {
            if (isWeixin()) {
                setTimeout(() => {
                    disShare();
                }, 500)
            }
            if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
                handleFontSize();
            } else {
                document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
            }

            function handleFontSize() {
                // 设置网页字体为默认大小
                WeixinJSBridge.invoke('setFontSizeCallback', {'fontSize': 0});
                // 重写设置网页字体大小的事件
                WeixinJSBridge.on('menu:setfont', function () {
                    WeixinJSBridge.invoke('setFontSizeCallback', {'fontSize': 0});
                });
            }
        })();
    </script>

// ============================ 在开发环境不接入 Fundebug ============================ let fundebug = { init() {}, }; let FundebugVue = class { install() {} }; // ============================ 在开发环境不接入 Fundebug ============================