Eruda 一个被人遗忘的调试神器
项目中如何引入?直接上代码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21function debugInit(type){
console.log('debugInit')
var debug = sessionStorage.getItem('debug') || type || false;
if(location.href && (location.href.includes('debug') || location.href.includes('dingnianhuiapp.superboss.cc'))) {
debug = true;
window._debug = true
}
if(debug) {
var script = document.createElement('script');
// script.src="https://dingtalkcdn.superboss.cc/nianhui/front/pc/vconsole.min.js";
script.src="//cdn.bootcss.com/eruda/1.5.2/eruda.min.js";
document.body.appendChild(script);
script.onload = function () {
// window.vConsole = new VConsole();
eruda.init();
}
sessionStorage.setItem('debug', true);
}
}
debugInit()