Skip to content

Instantly share code, notes, and snippets.

@Andyliwr
Last active June 19, 2019 02:39
Show Gist options
  • Save Andyliwr/28d35cb725eba7e8f600ac83feadef82 to your computer and use it in GitHub Desktop.
Save Andyliwr/28d35cb725eba7e8f600ac83feadef82 to your computer and use it in GitHub Desktop.
根据url中的debug参数决定是否加载vconsole
<script>
// 是否加入调试js
if (window.location.search.indexOf('debug=1') > -1) {
let script1 = document.createElement('script');
let script2 = document.createElement('script');
script1.src = '//s.thsi.cn/js/m/kh/page-creator/js/vconsole.min.js';
script2.innerHTML = "var vconsole = new VConsole();";
document.head.appendChild(script1);
script1.onload = () => {
console.log(`已经打开调试`);
document.head.appendChild(script2);
};
}
</script>
if(window.location.search.indexOf('debug=1')>-1){let script1=document.createElement('script');let script2=document.createElement('script');script1.src='//s.thsi.cn/js/m/khhttp://khtest.10jqka.com.cn/page-creator/js/vconsole.min.js';script2.innerHTML="var vconsole = new VConsole();";document.head.appendChild(script1);script1.onload=()=>{console.log(`已经打开调试`);document.head.appendChild(script2)}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment