Add vue router

This commit is contained in:
D. Scott Boggs 2023-06-25 10:29:32 -04:00
parent 6f5e23e022
commit ea5e5325b5
6 changed files with 46 additions and 10 deletions

View file

@ -1,11 +1,7 @@
<script setup lang="ts">
import Table from "./components/Table.vue";
import { RouterView } from 'vue-router'
</script>
<template>
<div class="container">
<Table></Table>
</div>
<RouterView />
</template>
<style scoped></style>

View file

@ -1,9 +1,12 @@
import { createApp } from 'vue'
import './style.scss'
import App from './App.vue'
import router from './router'
import { state } from "./state";
import 'bulma/css/bulma.css'
import App from './App.vue'
createApp(App).mount('#app')
state.populate()
const app = createApp(App)
app.use(router)
app.mount('#app')
state.populate()

13
client/src/router.ts Normal file
View file

@ -0,0 +1,13 @@
import { createRouter, createWebHistory } from 'vue-router'
import TableView from './views/TableView.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', component: TableView }
// for other pages:
// {path: '/', component: import('./views/TableView.vue')}
]
})
export default router

View file

@ -0,0 +1,11 @@
<script setup lang="ts">
import Table from "../components/Table.vue";
</script>
<template>
<div class="container">
<Table></Table>
</div>
</template>
<style scoped></style>