javascript - ESLint VueJS v-slot
问题描述
我在使用 v-slot 中的修饰符时遇到了 Eslint 的问题
我尝试在这个问题中遵循 nokazn 的回答: 'v-slot' 指令不支持任何修饰符 以及 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 错误旁边有效)
解决方案
同样的问题:"vue/valid-v-slot": "off"
为我使用工作!
<template v-slot:[`item.monto`]='{ item }'>
${{ formatCLP(item.monto) }}
</template>
推荐阅读
- c - 在 C 中管道标准输出
- php - RedbeanPHP 多对多关系 - 奇怪的行为
- javascript - JS:遍历div列表以通过onclick添加事件?
- php - 从非静态的多维数组中获取页面 id
- php - 如何正确使用 AngularJS $http.post 通过 PHP 更新 MySQLi 表?
- ios - 沿着 BezierPath 移动 UILabel 一段时间
- cordova-plugins - iOS12.1.2 Phonegap 中创建的应用程序中的键盘问题
- javascript - 如何在 Angular JS 中调用 java FTP 上传文件
- python - python:用户输入以分号作为分隔符加载csv
- r - SQLDF 在来自 R 的 PostgreSQL 查询上失败