Skip to content

Commit ddba47f

Browse files
authored
fix: reorder Vue component (#4748)
Reorder the Vue component based on the Vue convention: 1. `<script>` 2. `<template>` It's only a visual change of the code. It has no effect on the functionality.
1 parent 4df71be commit ddba47f

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

templates/vue-ts/src/App.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue';
3+
import { tables, reducers } from './module_bindings';
4+
import { useSpacetimeDB, useTable, useReducer } from 'spacetimedb/vue';
5+
6+
const conn = useSpacetimeDB();
7+
const name = ref('');
8+
9+
// Subscribe to all people in the database
10+
const [people] = useTable(tables.person);
11+
12+
const addReducer = useReducer(reducers.add);
13+
14+
const addPerson = () => {
15+
if (!name.value.trim() || !conn.isActive) return;
16+
17+
// Call the add reducer
18+
addReducer({ name: name.value });
19+
name.value = '';
20+
};
21+
</script>
22+
123
<template>
224
<div :style="{ padding: '2rem' }">
325
<h1>SpacetimeDB Vue App</h1>
@@ -37,25 +59,3 @@
3759
</div>
3860
</div>
3961
</template>
40-
41-
<script setup lang="ts">
42-
import { ref } from 'vue';
43-
import { tables, reducers } from './module_bindings';
44-
import { useSpacetimeDB, useTable, useReducer } from 'spacetimedb/vue';
45-
46-
const conn = useSpacetimeDB();
47-
const name = ref('');
48-
49-
// Subscribe to all people in the database
50-
const [people] = useTable(tables.person);
51-
52-
const addReducer = useReducer(reducers.add);
53-
54-
const addPerson = () => {
55-
if (!name.value.trim() || !conn.isActive) return;
56-
57-
// Call the add reducer
58-
addReducer({ name: name.value });
59-
name.value = '';
60-
};
61-
</script>

0 commit comments

Comments
 (0)