diff options
author | 2025-06-05 14:25:23 +0000 | |
---|---|---|
committer | 2025-06-05 14:25:23 +0000 | |
commit | e586d7d704d475afe3373a1de6ae20d504f79d6d (patch) | |
tree | 7e3fa24807cebd48a86bd40f866d792181191ee9 /examples/framework-vue/src | |
download | astro-latest.tar.gz astro-latest.tar.zst astro-latest.zip |
Sync from a8e1c0a7402940e0fc5beef669522b315052df1blatest
Diffstat (limited to 'examples/framework-vue/src')
-rw-r--r-- | examples/framework-vue/src/components/Counter.vue | 32 | ||||
-rw-r--r-- | examples/framework-vue/src/pages/index.astro | 33 |
2 files changed, 65 insertions, 0 deletions
diff --git a/examples/framework-vue/src/components/Counter.vue b/examples/framework-vue/src/components/Counter.vue new file mode 100644 index 000000000..11f2bf1b5 --- /dev/null +++ b/examples/framework-vue/src/components/Counter.vue @@ -0,0 +1,32 @@ +<script setup lang="ts"> +import { ref } from 'vue'; + +const count = ref(0); +const add = () => count.value++; +const subtract = () => count.value--; +</script> + +<template> + <div class="counter"> + <button @click="subtract">-</button> + <pre>{{ count }}</pre> + <button @click="add">+</button> + </div> + <div class="counter-message"> + <slot /> + </div> +</template> + +<style> +.counter { + display: grid; + font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); + margin-top: 2em; + place-items: center; +} + +.counter-message { + text-align: center; +} +</style> diff --git a/examples/framework-vue/src/pages/index.astro b/examples/framework-vue/src/pages/index.astro new file mode 100644 index 000000000..bae5effe8 --- /dev/null +++ b/examples/framework-vue/src/pages/index.astro @@ -0,0 +1,33 @@ +--- +// Component Imports +import Counter from '../components/Counter.vue'; + +// Full Astro Component Syntax: +// https://docs.astro.build/basics/astro-components/ +--- + +<html lang="en"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width" /> + <meta name="generator" content={Astro.generator} /> + <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> + <style> + html, + body { + font-family: system-ui; + margin: 0; + } + body { + padding: 2rem; + } + </style> + </head> + <body> + <main> + <Counter client:visible> + <h1>Hello, Vue!</h1> + </Counter> + </main> + </body> +</html> |