使用vue创建的项目,由于自动加载了eslint这个插件,eslint的默认配置是在package.json文件里的
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"**eslint:recommended**"
],
"rules": {
},
"parserOptions": {
"parser": "babel-eslint"
}
},
由于使用了eslint:recommended的配置(也可以使用standard配置),所以默认不开启对console对象的支持,需要使用window.console才能打印日志。
解决办法:在rules中加入"no-console": “off”。这样就可以使用console了。
"rules": {
"no-console": "off"
},
在使用Vue创建的项目中,由于自动加载了eslint插件,默认配置不支持console对象。本文介绍如何在rules中加入no-console: off来启用console功能。
1430

被折叠的 条评论
为什么被折叠?



