vuejs / vue-template-es2015-compiler

Support a subset of handy ES2015 features in Vue 2.0 templates.
61 stars 23 forks source link

the `thisArg` argument of `apply` after arrow function transpiled is not correct #13

Closed xiaodemen closed 5 years ago

xiaodemen commented 5 years ago

please see: https://codesandbox.io/s/lx0y79rlnl click Button 'GO' ,then a error happened: Uncaught ReferenceError: store is not defined

<button @click="(...args) => { store.foo(...args) }">Go</button>

is transpiled as below:

click: function() {
  ...
  _vm.store.foo.apply(store, args)     // should be:  _vm.store.foo.apply(_vm.store, args)
}
yyx990803 commented 5 years ago

Fixed in 1.8.2

https://github.com/yyx990803/buble/commit/7271377867fdd16a76f87942e728bc9015fe661f https://github.com/vuejs/vue-template-es2015-compiler/commit/c7afaf4d768a4103bc517e4502ce81bc6048e701