[英]ionic - `slot` attributes are deprecated - eslint-plugin-vue
这个插槽实际上是指 webcomponent 插槽;
https://github.com/ionic-team/ionic-framework/issues/22236
Ionic Framework 使用的插槽与 Vue 2 插槽不同。 我们使用的插槽是 Web 组件插槽并且是有效的用法: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots 。
根据我们的文档,开发人员应该使用 Web 组件插槽到 position 元素: https://ionicframework.com/docs/api/range#usage
检查以确保您的 eslint.js 具有以下规则:
rules: {
'vue/no-deprecated-slot-attribute': 'off',
}
接下来打开.vscode/settings.json 并添加以下内容:
"vetur.validation.template": false,
vue/no-deprecated-slot-attribute
警告实际上是关于Vue 模板中的slot
属性,它被替换为v-slot
。 但是,由于 Ionic Web 组件使用原生slot
属性,您可以放心地忽略该警告,或禁用它:
// .eslintrc.js
module.exports = {
rules: {
'vue/no-deprecated-slot-attribute': 'off',
}
}
如果将 VS Code 与 Vetur 一起使用,请禁用 Vetur 的模板验证,它会忽略.eslintrc.js
。 Vetur 文档推荐使用 ESLint 插件来配置你自己的 ESLint 规则:
如果要配置 ESLint 规则,请执行以下操作:
- 用
vetur.validation.template: false
关闭 Vetur 的模板验证- 确保你有ESLint 插件。 错误将来自 ESLint 插件,而不是 Vetur。
yarn add -D eslint eslint-plugin-vue
在你的工作区根目录- 在
.eslintrc
中设置 ESLint 规则。
fixed
关于'fixed' is defined but never used
您评论过的错误,您在 SFC 中的<script>
部分可能有一个名为fixed
的未使用变量。 只需删除该变量即可解决错误。
您可以尝试将其添加到.vscode/settings.json
{
"vetur.validation.template": false
}
只需使用// eslint-disable-next-line
或eslint-disable-line
在包含插槽标签的下一行禁用 eslint 并继续使用代码,如果您希望继续使用相同的代码
或者
您可以使用<template v-slot>
来使用未命名的插槽标签,使用<template v-slot="name>
来使用命名插槽标签。
这是文档链接的链接,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.