I have the following code below. How can I set the value of "e.detail.name" to "nodeName" and then call it in another method within the same component so I can use the value for an API call.
data() {
return {
nodeName: '',
},
}
getNodeClicked() {
window.addEventListener('node_clicked', (e) => { console.log(e.detail.name) })
},
CodePudding user response:
Isn't it just this (am I missing something?):
data() {
return {
nodeName: '',
},
}
getNodeClicked() {
window.addEventListener('node_clicked', (e) => this.nodeName = e.detail.name)
},