【发布时间】:2021-08-06 11:28:35
【问题描述】:
我在一个活件刀片文件中有一个 laravel 发射,如下所示:
<script>
document.addEventListener('livewire:load', function () {
setTimeout(()=>{
Livewire.emit('nextSlot');
}, 4000);
});
</script>
这不起作用,它不会在受尊重的 php 文件中发出 nextSlot 函数。
注意,这个 hwoever 确实按预期工作:
<button wire:click="nextSlot">
Next Slot
</button>
为什么我在<script> 标签内的发射不起作用?
在 setTimeout 之后我该怎么做才能发出事件?
【问题讨论】:
标签: javascript laravel laravel-livewire