style:新增登录界面 完善api请求逻辑
This commit is contained in:
@@ -49,6 +49,7 @@ defineOptions({
|
||||
});
|
||||
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
|
||||
// 响应式断点(小屏阈值,小于此值视为小屏)
|
||||
const BREAKPOINT = 1024;
|
||||
@@ -158,7 +159,16 @@ const handleSideMenuSelect = (menuPath: string) => {
|
||||
|
||||
// 初始化:默认选中第一个菜单
|
||||
onMounted(() => {
|
||||
if (topLevelMenuList.value.length > 0) {
|
||||
|
||||
const currentRoutePath = router.currentRoute.value.path;
|
||||
const matchedTopMenu = topLevelMenuList.value.find(menu =>
|
||||
currentRoutePath.startsWith(`${menu.path}/`) || currentRoutePath === menu.path
|
||||
);
|
||||
|
||||
if (matchedTopMenu && matchedTopMenu.path) {
|
||||
selectedTopMenu.value = matchedTopMenu.path;
|
||||
} else if (topLevelMenuList.value.length > 0) {
|
||||
// 否则默认选中第一个菜单
|
||||
const firstMenu = topLevelMenuList.value[0];
|
||||
if (firstMenu && firstMenu.path) {
|
||||
selectedTopMenu.value = firstMenu.path;
|
||||
|
||||
Reference in New Issue
Block a user