【发布时间】:2021-02-27 19:47:12
【问题描述】:
我在使用 v-slot 中的修饰符时遇到了 Eslint 的问题
我尝试按照 nokazn 在这个问题中的回答: 'v-slot' directive doesn't support any modifier 以及 vuejs 的 lint 文档 https://eslint.vuejs.org/rules/valid-v-slot.html
我在我的.eslintrc.js 文件中添加:
'vue/valid-v-slot': ['error', {
allowModifiers: true,
}],
但我在验证 lint 文件时遇到以下错误:
Configuration for rule "vue/valid-v-slot" is invalid:
Value [{"allowModifiers":true}] should NOT have more than 0 items.
我试图让 lint 接受的是以下代码:
<v-data-table
:headers="headers"
:items="data"
disable-pagination
fixed-header
>
<template v-slot:item.EDIT>
<v-btn icon>
<v-icon>mdi-pencil</v-icon>
</v-btn>
</template>
</v-data-table>
(请注意,此代码在 lint 错误旁边有效)
【问题讨论】:
-
你使用的是最新的 ESLint 插件吗?
allowModifiers在 7.1.0 中添加。 github.com/vuejs/eslint-plugin-vue/releases/tag/v7.1.0 -
是的,从我的 package.json :“eslint”:“^7.13.0”,“eslint-config-airbnb-base”:“^14.2.1”,“eslint-plugin” -import": "^2.22.1", "eslint-plugin-vue": "^7.1.0",
-
不,不抱歉,我的问题是如何编写 esLint 行,而不是如何重写我的代码
标签: javascript vuejs2 eslint v-slot