//在app.vue添加一下代码
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: "App",
data() {
return {};
},
methods:{
},
mounted() {
if (process.env.mode === 'production') {
(function noDebugger() {
function testDebugger() {
var d = new Date();
debugger;
if (new Date() - d > 10) {
document.body.innerHTML = '<div>管理员已禁用调试模式!!!年轻人,不要太好奇</div>';
alert("管理员已禁用调试模式")
return true;
}
return false;
}
function start() {
while (testDebugger()) {
testDebugger();
}
}
if (!testDebugger()) {
window.onblur = function () {
setTimeout(function () {
start();
}, 500);
};
} else {
start();
}
})();
}
},
};
</script>
<style>
#app {
/* font-family: Avenir, Helvetica, Arial, sans-serif; */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
/* width: 100vw; */
height: 100vh;
overflow: hidden;
box-sizing: border-box;
}
</style>
vue禁止打开调试模式方法
最新推荐文章于 2024-05-11 17:30:34 发布