Skip to content

vue/enforce-style-attribute ​

强制或禁止在 SFC 顶层样式标签中使用 scoped 和 module 属性

¥enforce or forbid the use of the scoped and module attributes in SFC top level style tags

📖 规则详情 ​

此规则允许你明确允许在顶层样式标签上使用 scoped 和 module 属性。

¥This rule allows you to explicitly allow the use of the scoped and module attributes on your top level style tags.

"scoped" ​

Now loading...

"module" ​

Now loading...

"plain" ​

Now loading...

🔧选项 ​

¥🔧 Options

json
{
  "vue/enforce-style-attribute": [
    "error",
    { "allow": ["scoped", "module", "plain"] }
  ]
}
  • "allow"(["scoped" | "module" | "plain"])允许在顶层样式标签上使用的属性数组。选项 plain 用于允许既没有 scoped 也没有 module 属性的样式标记。默认值:["scoped"]

    ¥"allow" (["scoped" | "module" | "plain"]) Array of attributes to allow on a top level style tag. The option plain is used to allow style tags that have neither the scoped nor module attributes. Default: ["scoped"]

🚀版本 ​

¥🚀 Version

此规则是在 eslint-plugin-vue v9.20.0 中引入的

¥This rule was introduced in eslint-plugin-vue v9.20.0

🔍代码实现 ​

¥🔍 Implementation

eslint-plugin-vue v10.4 中文网 - 粤ICP备13048890号