Appearance
vue/no-restricted-html-elements
禁止特定 HTML 元素
¥disallow specific HTML elements
📖 规则详情
此规则允许你指定你不想在应用中使用的 HTML 元素。
¥This rule allows you to specify HTML elements that you don't want to use in your application.
🔧选项
¥🔧 Options
此规则采用字符串列表,其中每个字符串都是要限制的 HTML 元素名称:
¥This rule takes a list of strings, where each string is an HTML element name to be restricted:
json
{
"vue/no-restricted-html-elements": ["error", "button", "marquee"]
}
或者,该规则也接受对象。
¥Alternatively, the rule also accepts objects.
json
{
"vue/no-restricted-html-elements": [
"error",
{
"element": "button",
"message": "Prefer use of our custom <AppButton /> component"
},
{
"element": "marquee",
"message": "Do not use deprecated HTML tags"
}
]
}
可以为对象指定以下属性。
¥The following properties can be specified for the object.
element
...指定 html 元素。¥
element
... Specify the html element.message
...指定可选的自定义消息。¥
message
... Specify an optional custom message.
{ "element": "marquee" }, { "element": "button" }
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v8.6.0 中引入
¥This rule was introduced in eslint-plugin-vue v8.6.0
🔍代码实现
¥🔍 Implementation