gpt4 book ai didi

vue.js - 为什么我不能在我的 Vue 应用程序上使用调试器或 console.log

转载 作者:行者123 更新时间:2023-12-01 21:54:42 25 4
gpt4 key购买 nike

我刚刚通过 Vue CLI 创建了一个新的 Vue 应用程序,但是我不能使用调试器或 console.log 否则我会在浏览器中收到错误,为什么以及如何允许它

Unexpected 'debugger' statement (no-debugger) at src/components/SomeComponent.vue:48:7

最佳答案

在我的例子中,这是因为我在创建项目时使用了默认配置,它包括 eslint:

my project's plugins

因此,为了允许调试器和 console.log 语句,我修改了 package.json 文件中的规则,如下所示:

  "eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": 1,
"no-debugger": 1
},
"parserOptions": {
"parser": "babel-eslint"
}
}

这样我在编译时仍然会收到警告,所以我不会忘记在提交之前删除它们,但我可以运行我的应用程序并使用这些语句。

关于vue.js - 为什么我不能在我的 Vue 应用程序上使用调试器或 console.log,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58614732/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com