Skip to content

vue/this-in-template

禁止在模板中使用 this

  • ⚙️ 此规则包含在 "plugin:vue/recommended"*.configs["flat/recommended"]"plugin:vue/vue2-recommended"*.configs["flat/vue2-recommended"] 中。
  • 🔧命令行 上的 --fix 选项可以自动修复此规则报告的一些问题。

    ¥🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 规则详情

此规则旨在防止在 Vue 模板中使用 this

¥This rule aims at preventing usage of this in Vue templates.

Now loading...

🔧选项

¥🔧 Options

json
{
  "vue/this-in-template": ["error", "always" | "never"]
}
  • "always" ...从 Vue 访问属性时始终使用 this

    ¥"always" ... Always use this while accessing properties from Vue.

  • "never"(默认)...切勿在表达式中使用 this 关键字。

    ¥"never" (default) ... Never use this keyword in expressions.

"always"

Now loading...

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v3.13.0 中引入

¥This rule was introduced in eslint-plugin-vue v3.13.0

🔍代码实现

¥🔍 Implementation

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