vue/html-button-has-type
禁止使用没有显式 type 属性的按钮
忘记在按钮上添加 type 属性会将其默认设置为 submit 类型。这几乎永远不是预期的行为,尤其是在您的一般单页应用程序中。
📖 规则详情
此规则旨在警告如果在按钮类型属性上使用没有类型或无效类型。
正在加载...
🔧 选项
json
{
"vue/html-button-has-type": ["error", {
"button": true,
"submit": true,
"reset": true
}]
}
button
...<button type="button"></button>
true
(默认) ... 允许值button
。false
... 不允许值button
。
submit
...<button type="submit"></button>
true
(默认) ... 允许值submit
。false
... 不允许值submit
。
reset
...<button type="reset"></button>
true
(默认) ... 允许值reset
。false
... 不允许值reset
。
🚀 版本
此规则是在 eslint-plugin-vue v7.6.0 中引入的