我想消除我的vue文件中的这个错误

我正在try 添加这个处理器行

<!-- eslint-disable-next-line vue/no-use-v-if-with-v-for -->

<!-- eslint-disable-next-line vue/no-confusing-v-for-v-if  -->

但两者都不是

enter image description here

也没有

enter image description here

解除eslint警告

[eslint plugin vue][vue/no-use-v-if-with-v-for]

我在this个样本中添加了Pressor行,但eslint仍然对下一行发出警告.

注:这个解决方案不是最好的,但我需要这样的过渡动画.

推荐答案

Vetur's documentation:

安装ESLint plugin以获得最佳的起毛体验.Vetur's template linting is only for quick start and does not support rule configuration

所以,你必须:

  1. 安装ESLint plugin

  2. 启用vue插件并禁用Vetur的linting(添加到VS代码配置中):

    "vetur.validation.template": false,
    "eslint.validate": [
      "javascript",
      "javascriptreact",
      "vue"
    ]
    

如果尚未安装eslint和/或eslint-plugin-vue,则应:

npm i eslint babel-eslint eslint-plugin-vue --save-dev

ESLint的简单配置:

{
  "root": true,
  "env": {
    "node": true
  },
  "extends": ["plugin:vue/essential", "eslint:recommended"],
  "rules": {
  },
  "parserOptions": {
    "parser": "babel-eslint"
  }
}

您应该将其保存到.eslintrc文件或eslintConfig名称下的package.json.

而且,它是有效的:

Vue.js相关问答推荐

获取深度嵌套对象时无法读取空/未定义的属性

为什么元素会从Vue 3中的TransitionGroup左上角出现?

如何防止Nuxt3重新加载时滚动跳到网页顶部

写入计算值时出错,但我没有写入任何值

过渡如何在 Vue JS 3 中的图像上工作?

如何通过 setup() 发出多个参数?

webpack vue-loader 配置

如何在 Nativescript 应用程序中调用 axios/api 调用

VueJS:如何在组件数据属性中引用 this.$store

Vue动态mapGetters

使用数组元素的计算(computed)属性

如何在 vuejs 中异步加载图像 src url?

如何在nuxt路由中添加meta?

此 set-cookie 已被阻止,因为它具有 samesite=lax

为 webpack HMR Vue.js 包含来自外部项目文件夹的可导入模块

加载时焦点文本框上的 Vue.js

如何在 Vue.js 应用程序中正确下载 Excel 文件?

使用 CloudFront 部署在 S3 上的 VueJS 应用程序的指定的密钥不存在

Vue-i18n - 无法读取未定义的属性配置

在~/components/AddPlaceModal.vue中找不到导出AddPlaceModal