您的当前位置:首页>全部文章>文章详情

移动端调试插件vConsole

发表于:2024-09-04 08:37:28浏览:117次TAG: #javascript

引言

在移动端打开F12控制台进行调试

使用

源码:https://github.com/Tencent/vConsole

  • 方式一:直接引入

    <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
    <script>
    // VConsole will be exported to `window.VConsole` by default.
    var vConsole = new window.VConsole();
    </script>
    
  • 方式二:NPM安装

    npm install vconsole
    

    提示:若是安装失败,则过些时间再安装,特别是晚上,经常会安装不上

// #ifdef H5
import VConsole from 'vconsole';

const vConsole = new VConsole();
// or init with options
const vConsole = new VConsole({ theme: 'dark' });

// call `console` methods as usual
console.log('Hello world');

// remove it when you finish debugging
vConsole.destroy();
// #endif