Appearance
vue/no-arrow-functions-in-watch
禁止使用箭头函数定义观察者
- ⚙️ 此规则包含在
"plugin:vue/essential"
、*.configs["flat/essential"]
、"plugin:vue/vue2-essential"
、*.configs["flat/vue2-essential"]
、"plugin:vue/strongly-recommended"
、*.configs["flat/strongly-recommended"]
、"plugin:vue/vue2-strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/recommended"
、*.configs["flat/recommended"]
、"plugin:vue/vue2-recommended"
和*.configs["flat/vue2-recommended"]
中。
📖 规则详情
此规则禁止在定义观察者时使用箭头函数。箭头函数绑定到其父上下文,这意味着它们将无法通过 this
访问 Vue 组件实例。查看此处了解更多详情。
¥This rule disallows using arrow functions when defining a watcher. Arrow functions bind to their parent context, which means they will not have access to the Vue component instance via this
. See here for more details.
🔧选项
¥🔧 Options
无。
¥Nothing.
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
🔍代码实现
¥🔍 Implementation