使用Vue添加组件的报错

报错“Component name "Home" should always be multi-word.”

在根目录创建.eslintrc.js文件

module.exports = {

  root: true,

  env: {

    node: true,

  },

  extends: ["plugin:vue/essential", "eslint:recommended"],

  parserOptions: {

    parser: "@babel/eslint-parser",

  },

  rules: {

    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",

    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", //在rules中添加自定义规则 //关闭组件命名规则

    "vue/multi-word-component-names": "off",

    "vue/no-multiple-template-root": "off"

  },

  overrides: [

    {

      files: [

        "**/__tests__/*.{j,t}s?(x)",

        "**/tests/unit/**/*.spec.{j,t}s?(x)",

      ],

      env: {

        jest: true,

      },

    },

  ],

};

2.创建interface报错(之前有个import type也报错,但是这样之后就好了,可能和这个也有关系)

Parsing error: The keyword 'interface' is reserved

后来发现以下方法可以解决问题:添加 .eslintrc.js文件

'parser': '@typescript-eslint/parser'

记得需要安装依赖npm install @typescript-eslint/parser --save-dev

3.v-modal报错

'v-model' directives require no argument  vue/no-v-model-argument

在 .eslintrc.js文件添加

rules: {

        "vue/no-v-model-argument":  "off"

}   

需要手动重启服务器

4.'xxxx' is defined but never used

.eslintrc.js中找到  eslintConfig  块,在其rules下加入"no-unused-vars": "off"即可

需要手动重启服务器

5.Ref<boolean>无法赋值给 <boolean>类型

const res = ref(true)
// 赋值的时候需要用 res.value
const temp:boolean = res.value

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值