Currently, I'm trying to add a feature that automatically closes all menus and modals when a user clicks outside of the specified area.
Although I am successfully calling this.closeMenu()
, an error is occurring stating that this.closeMenu
is not recognized as a function. What could be causing this issue?
methods: Object.assign({},
{
closeMenu(){
console.log("close menu")
}
}
)
mounted(){
$(document).on('click', function(event) {
if (!$(event.target).closest('.menu').length){
// Close all menus here
this.closeMenu()
}
});
}