Add vue router
This commit is contained in:
parent
55816a486a
commit
c7cfa86be1
6 changed files with 46 additions and 10 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
13
client/src/router.ts
Normal 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
|
||||
11
client/src/views/TableView.vue
Normal file
11
client/src/views/TableView.vue
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue