Last active
June 19, 2019 02:39
-
-
Save Andyliwr/28d35cb725eba7e8f600ac83feadef82 to your computer and use it in GitHub Desktop.
根据url中的debug参数决定是否加载vconsole
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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