老师请教一下
来源:19-1 登录页面 - Vue3改造

幻城163630
2021-04-16
老师vue3不可以console和debugger了吗?vue2我用起来就没报过错。
3回答
-
河畔一角
2021-06-24
这个只是因为eslint不允许console和debugger,你下面的方法倒也是方案,不过可以直接打开浏览器的source进行断点调试
00 -
幻城163630
提问者
2021-04-17
嗯,老师后面讲了,我知道怎么改了,但是我的vscode并没有报错,而且我也没有关闭Vetur › Validation: Script,我是直接创建一个新的文件.eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/no-parsing-error': [2, { 'x-invalid-end-tag': false }] // 关闭对iview end-tag 检查
},
parserOptions: {
parser: 'babel-eslint'
}
}就没有报错了,这里想问一下老师知道我的编辑器没有报错的原因不?
00 -
幻城163630
提问者
2021-04-17
控制台是有输出,但就是报错,老师请问有没有解决方法
error: Unexpected console statement (no-console) at src\pages\index.vue:192:11:
190 | res.list = res.list.slice(6,14);
191 | phoneList.value = [res.list.slice(0,4),res.list.slice(4,8)];
> 192 | console.log(phoneList);
| ^
193 | })
194 | };
195 | let addCart=(id)=>{
00