vue/no-restricted-v-on
禁止在
v-on
中使用特定参数
📖 规则详情
此规则允许您指定在应用程序中不想使用的 v-on
参数名称。
🔧 选项
此规则接受字符串列表,其中每个字符串都是要限制的参数名称或模式。
json
{
"vue/no-restricted-v-on": ["error", "foo", "/^bar/"]
}
或者,此规则也接受对象。
json
{
"vue/no-restricted-v-on": [
"error",
{
"argument": "foo",
"message": "Use \"v-on:x\" instead."
},
{
"argument": "bar",
"message": "\"@bar\" is deprecated."
}
]
}
可以为对象指定以下属性。
argument
... 指定参数名称或模式或null
。如果指定null
,则匹配v-on=
。modifiers
... 指定修饰符名称数组。如果指定,则只有在使用指定的修饰符时才会报告。element
... 指定元素名称或模式。如果指定,则只有在对指定元素使用时才会报告。message
... 指定可选的自定义消息。
{ "argument": "foo", "modifiers": ["prevent"] }
{ "argument": "foo", "element": "MyButton" }
👫 相关规则
🚀 版本
此规则是在 eslint-plugin-vue v9.21.0 中引入的。