我在我的 Rails 应用程序中有一个 JavaScript 类,它使用 Sprockets 中的 Uglifier 来压缩 JS(在后台我相信它使用:https ://github.com/mishoo/UglifyJS )
class FormValidation {
connect() {
this.element.setAttribute('novalidate', true)
this.element.addEventListener('blur', this.onBlur, true)
}
onBlur = (event) => {
this.validateField(event.target)
}
... rest of code hidden for benefit of question.
而且 UglifyJS 不喜欢=
我onBlur
命名的方法中的...Parse error: Unexpected token: operator (=).
Harmony 设置为 true 以支持 ES6……但仍然出现此错误……我该如何解决这个问题?因为我不得不删除压缩,所以我可以在我的代码中使用我的类......