碰到一个奇葩的事情,使用箭头函数的时候,无法获得this,不使用才能获取,真是无语。

// 这样不行
beforeRouteLeave: (to, from, next) => {}

// 这样可以
beforeRouteLeave: function (to, from, next) {}

这不是搞笑么。

最后编辑:2023年10月29日 ©著作权归作者所有

发表评论