feat: support play

This commit is contained in:
Rogee
2024-12-11 20:07:17 +08:00
parent 59d2beddbf
commit 7b9f6d444f
10 changed files with 184 additions and 21 deletions

View File

@@ -1,3 +1,4 @@
import NotFound from '@/views/NotFound.vue'
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/tabs/HomeView.vue'
import TabView from '../views/TabView.vue'
@@ -5,13 +6,14 @@ import TabView from '../views/TabView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound },
{
path: '/tab',
path: '/t/:tenant',
name: 'tab',
component: TabView,
children: [
{
path: 'home',
path: '',
name: 'tab.home',
component: HomeView,
},
@@ -21,8 +23,8 @@ const router = createRouter({
component: () => import('../views/tabs/BoughtView.vue'),
},
{
path: 'me',
name: 'tab.me',
path: 'user',
name: 'tab.user',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
@@ -31,7 +33,7 @@ const router = createRouter({
]
},
{
path: '/play/{:id}',
path: '/t/:tenant/play/:hash',
name: 'play',
component: () => import('../views/PlayView.vue'),
},
@@ -40,12 +42,6 @@ const router = createRouter({
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