vue/v-slot-style
强制执行
v-slot指令样式
- ⚙️ 此规则包含在所有
"plugin:vue/vue3-strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/vue3-recommended"、*.configs["flat/recommended"]、"plugin:vue/recommended"和*.configs["flat/vue2-recommended"]中。 - 🔧 命令行 上的
--fix选项可以自动修复此规则报告的一些问题。
📖 规则详细信息
此规则强制执行 v-slot 指令样式,您应该使用简写或长格式。
🔧 选项
json
{
"vue/v-slot-style": ["error", {
"atComponent": "shorthand" | "longform" | "v-slot",
"default": "shorthand" | "longform" | "v-slot",
"named": "shorthand" | "longform",
}]
}| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
atComponent | "shorthand" | "longform" | "v-slot" | "v-slot" | 自定义组件直接默认插槽的样式(例如 <my-component v-slot="">)。 |
default | "shorthand" | "longform" | "v-slot" | "shorthand" | 模板包装器默认插槽的样式(例如 <template #default="">)。 |
named | "shorthand" | "longform" | "shorthand" | 命名插槽的样式(例如 <template #named="">)。 |
每个值的意思
"shorthand"... 使用#简写。例如#default、#named、..."longform"... 使用v-slot:指令符号。例如v-slot:default、v-slot:named、..."v-slot"... 使用v-slot而不带该参数。这比#default简写更短。
为了与类似的 vue/v-bind-style 和 vue/v-on-style 保持一致,也支持字符串选项。
["error", "longform"]等同于["error", { atComponent: "longform", default: "longform", named: "longform" }]。["error", "shorthand"]等同于["error", { atComponent: "shorthand", default: "shorthand", named: "shorthand" }]。
"longform"
📚 进一步阅读
🚀 版本
此规则在 eslint-plugin-vue v6.0.0 中引入。