【问题标题】:Vue.js + eslint. Error Parsing error: Unexpected token @Vue.js + eslint。错误解析错误:意外的令牌@
【发布时间】:2021-01-15 12:09:57
【问题描述】:

我正在做项目 Django Rest Framework + Vue.js 我遇到了 eslint 的问题

error 解析错误:Unexpected token


   5 |     <b-container>
   6 |       <b-row class="question-row">
>  7 |         <b-form @submit="onSubmit" @reset="onReset">
     |                 ^
   8 |           <b-form-group id="input-group"
   9 |                         :label="getQuestion(1)"
  10 |                         label-for="input-1">

这是我的 .eslintrc.json 文件

{
  "env": {
    "es6": true,
    "node": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:vue/essential",
    "plugin:vue/base"
  ],
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 7,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "modules": true
    }
  },
  "plugins": [
    "vue"
  ],
  "rules": {
    "max-len": ["error", {"code": 121}],
    "semi": ["error","always"],
    "no-console": 0
  }
}

我需要 babel.config.json 吗?它是在初始化 Vue 项目后添加到我的项目中的。这是我的代码

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset',
  ],
};

【问题讨论】:

    标签: node.js vue.js pycharm eslint


    【解决方案1】:

    尝试将@submit 改为 v-on:submit

    【讨论】:

      猜你喜欢
      • 2018-08-14
      • 2019-12-25
      • 2022-01-02
      • 2017-11-21
      • 2017-07-16
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      相关资源
      最近更新 更多