Skip to content

vue/v-on-function-call

强制或禁止在 v-on 指令中不带参数的方法调用后使用括号

📖 规则详情

此规则旨在强制将方法绑定到 v-on 或在没有参数时调用 v-on 上的方法。

¥This rule aims to enforce to bind methods to v-on or call methods on v-on when without arguments.

Now loading...

🔧选项

¥🔧 Options

默认值设置为 never

¥Default is set to never.

json
{
  "vue/v-on-function-call": ["error",
    "always"|"never",
    {
      "ignoreIncludesComment": false
    }
  ]
}
  • "always" ...在 v-on 指令中始终使用括号。

    ¥"always" ... Always use parentheses in v-on directives.

  • "never" ...切勿在 v-on 指令中使用括号来调用不带参数的方法。这是默认的。

    ¥"never" ... Never use parentheses in v-on directives for method calls without arguments. this is default.

  • ignoreIncludesComment ...如果是 true,则不要报告包含注释的表达式。默认 false

    ¥ignoreIncludesComment ... If true, do not report expressions containing comments. default false.

"always" - 在 v-on 指令中始终使用括号

¥"always" - Always use parentheses in v-on directives

Now loading...

"never" - 对于不带参数的方法调用,切勿在 v-on 指令中使用括号

¥"never" - Never use parentheses in v-on directives for method calls without arguments

Now loading...

"never", { "ignoreIncludesComment": true }

Now loading...

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v5.2.0 中引入

¥This rule was introduced in eslint-plugin-vue v5.2.0

🔍代码实现

¥🔍 Implementation

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