vue/no-deprecated-v-is
禁止使用已废弃的 v-is 指令。
| 默认严重程度 | 预设 | 自动修复 | 选项 |
|---|---|---|---|
error |
essential, happy-path, nuxt, ecosystem, opinionated |
不支持 | 无 |
适用范围:Vue SFC 模板和代码块,包括规则所需的脚本上下文。
错误示例
v-is 已在 Vue 3.1 中废弃;示例仍用它切换渲染的组件。
<template>
<tr v-is="'MyRow'"></tr>
</template>
正确示例
改用带 vue: 前缀的 is 属性,或使用 <component :is> 选择组件。
<template>
<tr is="vue:MyRow"></tr>
<component :is="MyRow" />
</template>
配置(Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-deprecated-v-is": "error"
}
},
});
然后运行 vp run lint。