1.Trailing spaces not allowed
解决:把行末空格去除
2.Expected linebreaks to be "LF" but found "CRLF"
解决: .eslintrc.js中增加一条rule :
'linebreak-style': [0, 'error', 'windows']
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'linebreak-style':[0, 'error', 'windows']
3.Missing semicolon
解决:行末添加分号
4.Missing trailing comma
解决:行末添加逗号
5.Unexpected use of file extension "vue" for "./xxx/****.vue"
解决:去掉后缀名.vue
6.Unexpected use of file extension "js" for "./xxx/****.js"
解决:去掉后缀名.js
7.Unexpected console statement
解决1: .eslintrc.js中增加一条rule :
'no-console':'off'
解决2:改成window.console.log()
8.axios跨域问题
has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
解决:config/index.js中修改以下代码
proxyTable: {
'/fanyiec': { // 任意名字,axios发送请求时使用
target: '真正的URL地址', // 目标接口域名
secure: false,
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/fanyiec': '' // 根据需要自行设定
}
},
cssSourceMap: false
},
9.Unexpected string concatenation
原因:字符串连接时不建议使用+号,而是使用模板字符串
解决:console.log(`Fifteen is ${a + b} and not ${2 * a + b}.`);
注意不是单引号,是撇
模板字符串 - JavaScript | MDN (mozilla.org)
网友评论