From 1fbf7fd8f2dd97ddfcb6cff12fd3fc99ee61f6b1 Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期三, 03 七月 2024 19:39:08 +0800 Subject: [PATCH] # --- zy-asrs-admin/src/views/IndexView.vue | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/zy-asrs-admin/src/views/IndexView.vue b/zy-asrs-admin/src/views/IndexView.vue index abf58d4..0c0a1b1 100644 --- a/zy-asrs-admin/src/views/IndexView.vue +++ b/zy-asrs-admin/src/views/IndexView.vue @@ -1,5 +1,5 @@ <script setup> -import { nextTick, ref, inject } from 'vue'; +import { nextTick, ref, inject, onMounted } from 'vue'; import { useRouter } from "vue-router"; import { get, post, postForm } from '@/utils/request.js' import { logout } from '@/config.js'; @@ -32,6 +32,28 @@ ...Icons, }; +onMounted(() => { + let name = router.currentRoute.value.name; + let path = router.currentRoute.value.path; + if (currentCache.value == null && path != '/') { + get('/api/menu/get/route', { + route: path + }).then((resp) => { + let result = resp.data; + let data = result.data; + if (result.code == 200) { + currentCache.value = name; + routerCache.value.push(name) + routerCacheList.value.push({ + key: path, + languageId: data.languageId, + name: name, + }) + } + }) + } +}) + getMenu() function getMenu() { get('/api/auth/menu', {}).then((result) => { -- Gitblit v1.9.1