I have a component set up to communicate with a serial device via a plug-in, once the data is received it has a success function where it is processed and from there i want it to execute a function, in context my problem is that the this for the showNotify function stops working once its within the function success(){ ... }, the function in nestled inside watch: and showNotify defined in the methods:. I've tried with call() and bind() but im pretty sure i messed up the syntax as i have no experience with those tools.
// watch is on the look for a boolean than then triggers the serial write and readcallback,
// those work just fine and as intended, problem arises when reaching the code inside the function
watch: {
...
...
function success(){
this.showNotify();
}
...
...
},
methods: {
showNotify {
this.$q.notify({
position: 'bottom-left',
badgeStyle: 'background-color: transparent; box-shadow: none' ,
badgeTextColor: 'transparent',
message: 'Device Connected',
type: 'primary',
color: 'red-3',
})
}
}
When i remove the function(){} and just leave the this.showNotify() the notification appears, but i need it to execute from within the function. Any idea of a workaround for this or proper use of call() or bind() for vueJS?
Thanks!