t3-code-android-nightly/.repos/alchemy-effect/examples/prisma-website-nuxt/app/pages/index.vue
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

36 lines
1 KiB
Vue

<script setup lang="ts">
useHead({ title: "Nuxt on Prisma" });
const greeting = useState("greeting", () =>
import.meta.server ? (process.env.GREETING ?? "Hello!") : "Hello!",
);
const count = ref(0);
const responseGreeting = ref("");
async function loadGreeting() {
try {
const result = await $fetch<{ greeting: string }>(
"/api/hello?name=browser",
);
responseGreeting.value = result.greeting;
} catch {
responseGreeting.value = "Could not load the greeting. Try again.";
}
}
</script>
<template>
<main>
<h1 class="text-3xl font-bold">{{ greeting }}</h1>
<Card
title="Styled with Tailwind CSS"
body="This card is a Vue component styled with Tailwind utilities."
/>
<button type="button" @click="count++">count: {{ count }}</button>
<button type="button" @click="loadGreeting">Load greeting</button>
<p role="status">{{ responseGreeting }}</p>
<NuxtLink class="mt-4 inline-block underline" to="/about"
>about (prerendered)</NuxtLink
>
</main>
</template>