[Vuejs]-Laravel Nova | Arrow functions | computed property not working in Tool.vue

0πŸ‘

βœ…

It seems arrow functions are bound to the parent context. That was the reason my code did not work. this is then not bound to the Vue instance but the parent (Window) which causes it not to work.

Wrong:

setFile: (e) => {   
  this.importDisabled = false;
},

Right:

setFile: function() {   
  this.importDisabled = false;
},

More information:
https://codingexplained.com/coding/front-end/vue-js/using-es6-arrow-functions-vue-js

Leave a comment