v1 LiVue v1 is here — server-driven reactivity for Laravel using Vue.js Get Started →

Directives

Directive Showcase: v-poll

Run periodic refreshes from the client to keep server-driven data fresh.

How it works

v-poll runs a method at intervals. In this demo, the client calls refreshClock() every 3 seconds to keep server-driven data updated.

Auto polling target

Server time: 07:59:31

Ticks: 0

Ready

Uses v-poll.3s="'refreshClock'". Polling pauses automatically when the tab is hidden unless you add .keep-alive.

app/LiVue/PollDirectiveDemo.php
public function refreshClock(): void
{
    $this->ticks++;
    $this->serverTime = now()->format('H:i:s');
}
resources/views/livue/poll-directive-demo.blade.php
<div v-poll.3s="'refreshClock'">
    Server time: @{{ serverTime }}
</div>

<button v-click="refreshClock">
    Refresh now
</button>