简体   繁体   中英

how to send two parameters with livewire emit in javascript?

I have a function in livewire component like this:

public function deleteAccount($id,$approve){
// my code ...
}

and I want to emit this function from javascript. I tried:

<script>

 window.livewire.emit('deleteAccount', data => {123, true});

</script>

But it does not worked. Any suggestion?

You can do like this

<script>
 window.livewire.emit('deleteAccount', [123, true]);
</script>

This should work

Livewire.emit('deleteAccount', 123, true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM