Property assignment expected.Vetur(1136)-前端-E先生的博客
Java
MySQL
大数据
Python
前端
黑科技
大语言模型
    首页 >> 互联网 >> 前端

Property assignment expected.Vetur(1136)

[导读]:Property assignment expected.Vetur(1136)...
1.Property assignment expected.Vetur(1136)
 
使用装饰器可能会提示Property assignment expected.Vetur(1136)
因为使用eslint进行代码格式检查,所以可以关闭vetur验证script的能力,请在vscode settings里面添加下面代码
"vetur.validation.script": false,
 
2.Vue-error xx should be on a new line
 
此问题是由于.eslintrc.js文件中的vue/max-attributes-per-line配置错误产生的
    "vue/max-attributes-per-line": ['error', {
      "singleline": 10,
      "multiline": {
        "max": 1,
        "allowFirstLine": false
      }
    }],
 
解决方法:改为警告
 
    "vue/max-attributes-per-line": ['warn', {
      "singleline": 10,
      "multiline": {
        "max": 1,
        "allowFirstLine": false
      }
    }],
3.Unexpected space before function parentheses.
 
解决方案:在项目目录下找到.eslintrc.js文件,使用编辑器打开进行编辑。在rules下添加
 'space-before-function-paren': [
      'error',
      {
        anonymous: 'always',
        named: 'always',
        asyncArrow: 'always',
      }
    ],
 
4.Missing space before function parentheses.
 
使用eslint时,严格模式下,报错Missing space before function parentheses的问题,意思是在方法名和刮号之间需要有一格空格
在eros代码目录中,打开.eslint文件,并在rules中添加如下一行代码即可:
 "space-before-function-paren": 0

5. Configuration for rule "space-before-function-paren" is invalid:
 
1、报错原因:
根据报错提示,在vue项目中提示启用了eslint代码检测
ESLint是一个用来识别 ECMAScript 并且按照规则给出报告的代码检测工具,使用它可以避免低级错误和统一代码的风格。ESLint被设计为完全可配置的,对语法校验比较严格,可屏蔽校验。
2、解决方式:
1)、在build/webpack.base.conf.js文件中,注释掉
…(config.dev.useEslint ? [createLintingRule()] : []),这行配置,如下图:

本文来自E先生的博客,如若转载,请注明出处:https://www.javajz.cn

留言区

联系人:
手   机:
内   容:
验证码:

历史留言

欢迎加Easy的QQ