feat: add frontend

This commit is contained in:
Rogee
2024-11-28 12:25:36 +08:00
parent c06fc4c04a
commit c7d10908bd
23 changed files with 634 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/tabs/HomeView.vue'
import TabView from '../views/TabView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/tab',
name: 'tab',
component: TabView,
children: [
{
path: 'home',
name: 'tab.home',
component: HomeView,
},
{
path: 'bought',
name: 'tab.bought',
component: () => import('../views/tabs/BoughtView.vue'),
},
{
path: 'me',
name: 'tab.me',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/tabs/MeView.vue'),
},
]
},
{
path: '/play/{:id}',
name: 'play',
component: () => import('../views/PlayView.vue'),
},
],
})
router.beforeEach((to, from) => {
console.log("from", from, "goto: ", to)
if (to.path === "/" && from.path === "/") {
console.log("redirecting to tab.home")
return { name: "tab.home" }
}
})
export default router