Templates

Sigil

use PhoenixVapor

def render(assigns) do
  ~VUE"<p>{{ msg }}</p>"
end

Server-only .vue

use PhoenixVapor, file: "Page.vue"

No ref() in <script setup>.

Function component

require PhoenixVapor.Vue
PhoenixVapor.Vue.component(:card, "Card.vue")

At runtime

PhoenixVapor.render(template, assigns)

.vue LiveViews

Reactive

use PhoenixVapor,
  file: "Counter.vue",
  runtime: :reactive

Refs by name, params as __params.

Hybrid

use PhoenixVapor,
  file: "Contacts.vue",
  client_output: "assets/js/hybrid"

ref() in <script setup>.

Full runtime

use PhoenixVapor,
  file: "Dialog.vue",
  runtime: :full,
  bundle: "priv/js/reka-dialog.js",
  globals: %{"reka-ui" => "RekaDialog"}

Bundle task

mix phoenix_vapor.bundle \
  --entry assets/reka-entry.js \
  --name reka-dialog

Browser

Hooks and patching

import { patchLiveSocket } from "phoenix_vapor"
import { getHybridHooks } from "phoenix_vapor/hybrid"

Context pool

config :phoenix_vapor, pool: MyApp.JSPool