hi
I want to run alpinejs function from livewire component.
in posts component,
function gotcomment(){
$this->emit('gotcomment');
}
in posts view
<div wire:click="gotcomment">
I will get post
</div>
in blade.
<div x-data="myfunction()">
@livewire('posts')
</div>
<script>
window.livewire.on('gotcomment', () => {
console.log( '----')
this.callme() ; --> it goes error ..
});
function myfunction() {
return {
callme() {
console.log('callme')
},
}
}
</script>
this.callme() is not run…
How can I fire alpinejs function from livewire ?