Switch to using single-file components (SFC) in Vue

This commit is contained in:
Eli Ribble 2026-03-21 17:51:25 +00:00
parent ccdb391ccc
commit 0126d24242
No known key found for this signature in database
6 changed files with 362 additions and 21 deletions

20
ts/app.vue Normal file
View file

@ -0,0 +1,20 @@
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
const message = ref('Hello from Vue 3!');
</script>
<template>
<div>
<p>{{ message }}</p>
<button @click="count++">Count: {{ count }}</button>
</div>
</template>
<style scoped>
button {
padding: 0.5rem 1rem;
font-size: 1rem;
}
</style>

View file

@ -1,19 +1,4 @@
import { createApp } from 'vue';
// Simple example without SFCs
const App = {
data() {
return {
count: 0,
message: 'Hello from Vue 3!'
}
},
template: `
<div>
<p>{{ message }}</p>
<button @click="count++">Count: {{ count }}</button>
</div>
`
};
import App from './app.vue';
createApp(App).mount('#app');