Server-side Vue reactivity via QuickBEAM.
Use via: use PhoenixVapor, file: "X.vue", runtime: :reactive
Compiles <script setup> + <template> from a .vue file into a
fully functional LiveView with auto-generated mount, render, and
event handlers.
A persistent runtime (QuickBEAM with Vue's reactivity) is started per
LiveView process. ref() values become reactive state,
computed() auto-update when deps change, and functions execute in
the persistent JS context — state survives across events.
Usage
defmodule MyAppWeb.CounterLive do
use MyAppWeb, :live_view
use PhoenixVapor, file: "Counter.vue", runtime: :reactive
endGiven Counter.vue:
<script setup>
import { ref, computed } from "vue"
const count = ref(0)
const doubled = computed(() => count * 2)
function increment() { count++ }
</script>
<template>
<p>{{ count }} × 2 = {{ doubled }}</p>
<button @click="increment">+</button>
</template>This generates:
mount/3— starts aRuntimewith refs, computeds, and functionsrender/1— renders the template, compiled from Vize's split, with the runtime's statehandle_event/3— calls the function in the runtime, assigns new state
Summary
Functions
Picks the URL params named by keys and returns them as assigns.
Converts the state the component's runtime returns into assigns.
Functions
Picks the URL params named by keys and returns them as assigns.
Generated mount/3 callbacks pass the assign keys their template reads, so
a param never creates an atom.
Converts the state the component's runtime returns into assigns.
keys are the ref and computed names declared in the component, as atoms
created when it compiled.