[英]ESLint prefer-reflect error
I've got a problem with ESLint 我对ESLint有问题
Here is my function: 这是我的功能:
test(e) {
const target = [].slice.call(e.target.parentNode.children).indexOf(e.target)
this.goToItem(target)
}
And here is what ESLint tell me: 这是ESLint告诉我的:
Avoid using Function.prototype.call, instead use Reflect.apply
避免使用Function.prototype.call,而是使用Reflect.apply
I tried to find something to help me into the doc http://eslint.org/docs/rules/prefer-reflect . 我试图找到一些有助于文档http://eslint.org/docs/rules/prefer-reflect的内容 。 However I don't know where to put the slice...
但是我不知道将切片放在哪里...
How to solve this error please? 请如何解决此错误?
The MDN page on Reflect.apply()
gives you more info on how to use it: Reflect.apply()
的MDN页面为您提供了有关如何使用它的更多信息:
test(e) {
const target = Reflect.apply([].slice, e.target.parentNode.children, []).indexOf(e.target)
this.goToItem(target)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.