mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
fix routeer push on nav menu click
This commit is contained in:
@@ -19,14 +19,14 @@
|
||||
></el-button>
|
||||
</div>
|
||||
|
||||
<el-menu collapse router default-active="feed" :collapse-transition="false" ref="navMenuRef">
|
||||
<el-menu collapse default-active="feed" :collapse-transition="false" ref="navMenuRef">
|
||||
<el-popover
|
||||
v-for="item in navItems"
|
||||
:disabled="!item.entries?.length"
|
||||
:key="item.index"
|
||||
placement="right-start"
|
||||
trigger="hover"
|
||||
:hide-after="isSteamVRRunning ? 800 : 150"
|
||||
:hide-after="isSteamVRRunning ? 600 : 150"
|
||||
:show-arrow="false"
|
||||
:offset="0"
|
||||
:width="navPopoverWidth"
|
||||
@@ -50,7 +50,7 @@
|
||||
<span class="nav-menu-popover__menu-label"
|
||||
>{{ t(entry.label)
|
||||
}}<span
|
||||
v-if="route.path === entry.path"
|
||||
v-if="notifiedMenus.includes(entry.path.split('/').pop())"
|
||||
class="nav-menu-popover__menu-label-dot"></span
|
||||
></span>
|
||||
</button>
|
||||
@@ -64,7 +64,8 @@
|
||||
notify:
|
||||
notifiedMenus.includes(item.index) ||
|
||||
(notifiedMenus.includes('friend-log') && item.index === 'social')
|
||||
}">
|
||||
}"
|
||||
@click="handleRouteChange(item.index)">
|
||||
<i :class="item.icon"></i>
|
||||
<template #title v-if="item.tooltip">
|
||||
<span>{{ t(item.tooltip) }}</span>
|
||||
@@ -198,7 +199,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, h, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -371,6 +372,11 @@
|
||||
themeMenuVisible.value = false;
|
||||
};
|
||||
|
||||
const handleRouteChange = (index) => {
|
||||
router.push({ name: index });
|
||||
navMenuRef.value?.updateActiveIndex(index);
|
||||
};
|
||||
|
||||
watch(settingsMenuVisible, (visible) => {
|
||||
if (visible) {
|
||||
supportMenuVisible.value = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ const routes = [
|
||||
{ path: '/feed', name: 'feed', component: Feed },
|
||||
{
|
||||
path: '/friend-location',
|
||||
name: 'friendLocation',
|
||||
name: 'friend-location',
|
||||
component: FriendLocation
|
||||
},
|
||||
{ path: '/game-log', name: 'game-log', component: GameLog },
|
||||
@@ -53,9 +53,10 @@ export function initRouter(app) {
|
||||
|
||||
router.beforeEach((to, from) => {
|
||||
if (to.path == '/') {
|
||||
return { name: 'feed' };
|
||||
router.push({ name: 'feed' });
|
||||
return false;
|
||||
}
|
||||
if (to.path === '/social' || to.path === '/social/social') {
|
||||
if (to.path === '/social') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user