首先引入js (js文件可以直接去github上下载 https://github.com/Tencent/vConsole)
<!-- 引入vConsole的JS库 -->
<script src="js/dist/vconsole.min.js"></script>
初始化vconsole代码
<script>
// 初始化vConsole
window.vConsole = new window.VConsole({
defaultPlugins: ['system', 'network', 'element', 'storage', 'performance'], // 可以在此设定要默认加载的面板
maxLogNumber: 1000,
onReady: function() {
console.log('vConsole is ready.');
},
onClearLog: function() {
console.log('on clearLog');
}
});
</script>
下面用浏览器打开网页的时候就可以看到vconsole悬浮按钮点击即可查看
关于其他功能查看github
https://github.com/Tencent/vConsole/blob/dev/README_CN.md