I was wondering if is possible to define method/property name from variable.
Code
events: {
'reload:clients.client' () {
this.load()
}
},
I want to replace 'reload:clients.client' with a variable.
I was wondering if is possible to define method/property name from variable.
Code
events: {
'reload:clients.client' () {
this.load()
}
},
I want to replace 'reload:clients.client' with a variable.
This should do the trick:
let name = 'reload.clients.client'
let data = {
events: {
[name]: () => {
this.load()
}
}
}
console.log(data)