feat: player goback

This commit is contained in:
Rogee
2024-12-12 11:02:46 +08:00
parent acd827c346
commit 5676ace699
2 changed files with 25 additions and 2 deletions

View File

@@ -40,8 +40,19 @@ const router = createRouter({
], ],
}) })
router.beforeEach((to, from) => { router.beforeEach((to, from, next) => {
to.meta.from = {
name: from.name,
params: from.params,
}
console.log("from", from, "goto: ", to) console.log("from", from, "goto: ", to)
next()
// if (from.matched.length === 0) {
// next({ name: 'tab.home', params: to.params })
// } else {
// next()
// }
}) })
export default router export default router

View File

@@ -46,6 +46,9 @@ import Hls from "hls.js";
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
console.log("router: ", router);
console.log("route: ", route.meta);
const item = ref({ const item = ref({
title: "加载中...", title: "加载中...",
}) })
@@ -73,7 +76,16 @@ onMounted(() => {
}) })
const onClickLeft = () => { const onClickLeft = () => {
router.back(); if (route.meta.from?.name) {
router.back()
return;
}
router.replace({
name: 'tab.home',
params: {
tenant: route.params.tenant
}
});
}; };