The best way to control Claude Code, Codex and more from any computer or phone

main
vue 26 lines 913 Bytes
Raw
1 <script setup lang="ts">
2 useHead({ title: "Nuxt on Cloudflare" });
3
4 // SSR reads the Worker environment through nitro's cloudflare_module
5 // runtime contract: `event.context.cloudflare.env`. `useState` serializes
6 // the server-read value into the payload so the client render matches.
7 const greeting = useState("greeting", () => {
8 if (import.meta.server) {
9 const event = useRequestEvent();
10 const env = event?.context.cloudflare?.env as Record<string, unknown> | undefined;
11 return typeof env?.GREETING === "string" ? env.GREETING : "Hello!";
12 }
13 return "Hello!";
14 });
15 </script>
16
17 <template>
18 <main>
19 <h1 class="text-3xl font-bold">{{ greeting }}</h1>
20 <Card
21 title="Styled with Tailwind CSS"
22 body="This card is a Vue component styled with Tailwind utilities."
23 />
24 <NuxtLink class="mt-4 inline-block underline" to="/about">about (prerendered)</NuxtLink>
25 </main>
26 </template>