how to access data from inside a method
You cannot use an arrow function to refer to this
inside a Vue instance to get Vue instance data because this
refers to window
, the correct ES6 syntax is:
setAccountType(typeId){ this.accountType = typeId }
JSFiddle with Arrow function: https://jsfiddle.net/zxqohh0L/
JSFiddle with non arrow ES6 function: https://jsfiddle.net/zxqohh0L/1/
You can still use arrow functions inside the methods themselves.