当前位置:网站首页>Debug H5 page -vconsole
Debug H5 page -vconsole
2022-06-29 09:04:00 【CamilleZJ】
vConsole It's a light weight 、 Scalable 、 Debugging panel for front-end developers of mobile web pages .
git Address :https://github.com/Tencent/vConsole
The demo case :http://wechatfe.github.io/vconsole/demo.html
characteristic
- see console journal
- View network requests
- view pages element structure
- see Cookies、localStorage and SessionStorage
- Do it manually JS Command line
- Custom plug in
Use
stay html Page in , For multiple pages, it is necessary to introduce
1、cdn:
<script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
<script>
var vConsole = new VConsole();
console.log("hello world");
</script>2、npm:
npm install vconsoleImport dist/vconsole.min.js to your project(node_modules The position in is vconsole Under the dist Catalog )

<script src="path/to/vconsole.min.js"></script>
<script>
// init vConsole
var vConsole = new VConsole();
console.log('Hello world');
</script>For TypeScript users:
import 'path/to/vconsole.min.d.ts';3、 Modular introduction import / require etc.
import VConsole from 'vconsole'
const vConsole = new VConsole()4、webpack plugin
npm install vconsole-webpack-plugin --save-devstay webpack Configuration in profile :
// Introducing plug-ins
var vConsolePlugin = require('vconsole-webpack-plugin');
module.exports = {
...
plugins: [
new vConsolePlugin({
filter: [], // Entry file to be filtered
enable: true // Remember to change back to before publishing the code false, Set in development mode true
}),
...
]
...
}Be careful : The debug mode user will see the panel , For development environments only , Do not introduce... Into the production environment vConsole modular .
Support 5 There are different types of logs , It will be output to the front panel in different colors :
console.log("hello world"); // Black characters on white background
console.info("hello world"); // Purple characters on white background
console.debug("hello world"); // Yellow on a white background
console.warn("hello world"); // Yellow characters on yellow background
console.error("hello world"); // The scarlet letter on a red background introduce vConsole After module , The front of the page will appear in the lower right corner vConsole Hover button , Expandable / Fold up the panel :
Expand the panel as follows :

Public properties and methods
// At present vConsole Version number of .
vConsole.version
// Show vConsole Main panel
vConsole.show()
// hide vConsole Main panel
vConsole.hide()
// Destruct a vConsole Object instances , And will vConsole Remove panel from page .
var vConsole = new VConsole();
vConsole.destroy();
// Show vConsole On / off button of .
vConsole.showSwitch()
// hide vConsole On / off button of
vConsole.hideSwitch()
边栏推荐
- 微积分学习
- Enrollment brochure for system integration project management engineer certification in July 2022
- Verilog data type
- 手写 redux-thunk
- Verilog 拼接操作符号
- Scenario analysis of deadlock during MySQL insert
- hostname -f与uname -n的返回值可能不同
- 工作好多年,回忆人生--高中三年
- 51 MCU interrupt and timer counter, based on Puzhong technology hc6800-esv2.0
- 闭关修炼(二十四)浅入了解跨域问题
猜你喜欢
随机推荐
Verilog 大小端以及 +:使用
hostname -f与uname -n的返回值可能不同
cokkie和session的区别
搭建开源物联网平台教程
Does the SQL server run with administrator privileges? Or run it as a normal user?
记一些笔试题
2022春夏系列 KOREANO ESSENTIAL重塑时装生命力
P6776-[noi2020] surreal tree
乘法器设计(流水线)verilog code
Verilog equivalent operator
Is the securities account of qiniu school really safe and reliable?
MYSQL行转列例子
观察者模式怎么实现
Let you know today that the passing rate of the PMP Exam is 97%, is it believable
通过ELO机制衡量各类对弈活动水平
P4769-[noi2018] bubble sort [combinatorics, tree array]
(pytorch进阶之路三)encoder self attention mask
闭关修炼(二十二)session和cookie原理
成员内部类、静态内部类、局部内部类
General multiplier design, verilog code









