I have this computed function defined in a standalone Vue component
watchForCustomer() {
this.customerId = window.meta.page.customerId
if(this.customerId) {
$(document).on("click", function(element) {
let checkout = ['checkout'].includes(element.currentTarget.activeElement.name)
if(checkout) {
let checkoutForm = ['checkout', 'cart'].includes(element.currentTarget.activeElement.form.action.split('/').at(-1))
if(checkoutForm) {
getCustomerCredit()
}
}
})
}
},
The problem is that getCustomerCredit()
is not getting called.
I’ve tried to define it as:
this.getCustomerCredit
getCustomerCredit()
app.$options.getCustomerCredit()
and I get either that the function is not defined or it simply doesn’t call it.
So how can I call this getcustomerCredit
inside the document
on click event?