Skip to content

vue/no-this-in-before-route-enter

禁止在 beforeRouteEnter 方法中使用 this

¥disallow this usage in a beforeRouteEnter method

📖 规则详情

因为 beforeRouteEnter (文档) 中缺少 this。这种行为并不明显,因此很容易制作 TypeError。特别是在某些重构期间。

¥Because lack of this in the beforeRouteEnter (docs). This behavior isn't obvious, so it's pretty easy to make a TypeError. Especially during some refactor.

Now loading...
Now loading...

🔧选项

¥🔧 Options

无。

¥Nothing.

🔇何时不使用

¥🔇 When Not To Use It

当未安装 vue-router 时。

¥When vue-router is not installed.

📚扩展阅读

¥📚 Further Reading

vue-router - in-component-guards

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v7.11.0 中引入

¥This rule was introduced in eslint-plugin-vue v7.11.0

🔍代码实现

¥🔍 Implementation

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