From 261bb67c5c2ce8095d849b142abb799de53c0fa2 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 05 三月 2026 18:11:26 +0800
Subject: [PATCH] 更改头部
---
admin/src/main.js | 29 ++++-------------------------
1 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/admin/src/main.js b/admin/src/main.js
index a98f12b..6336fb5 100644
--- a/admin/src/main.js
+++ b/admin/src/main.js
@@ -29,7 +29,6 @@
Vue.use(directives)
Vue.use(filters)
Vue.use(plugins)
-
new Vue({
data: {
loading: false
@@ -45,16 +44,10 @@
return
}
await this.initRoutes()
- },
- async topMenuCurrent () {
- if (this.topMenuCurrent == null) {
- return
- }
- await this.chagneRoutes()
}
},
methods: {
- ...mapMutations(['switchCollapseMenu', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
+ ...mapMutations(['switchCollapseMenu', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent']),
// 鍒濆鍖栨湰鍦伴厤缃�
initLocalConfig () {
// 鑿滃崟鐘舵�侀厤缃�
@@ -85,13 +78,9 @@
})
storeTopMenus.push.apply(storeTopMenus, topList)
var topCurrent = null
- var tlist =[]
topList.forEach(item => {
- if (item.linkType === 0 ) {
- if (topCurrent == null) {
- topCurrent = item
- }
- tlist.push(...item.children)
+ if (item.linkType === 0 && topCurrent == null) {
+ topCurrent = item
}
})
this.setTopMenuCurrent(topCurrent)
@@ -106,7 +95,7 @@
console.log('menus', this.menuData.list)
storeMenus.push.apply(storeMenus, this.menuData.list)
// 娣诲姞璺敱
- this.__addRouters(tlist)
+ this.__addRouters(storeMenus)
// 404
router.addRoute({
path: '*',
@@ -129,16 +118,6 @@
.finally(() => {
this.loading = false
})
- },
- async chagneRoutes () {
- // 閲嶇疆鑿滃崟
- this.cleartagsview('/index')
- console.log('menus', this.menuData.list)
- // 娣诲姞璺敱
- // this.__addRouters(this.menuData.list)
- if(this.topMenuCurrent.homeUrl){
- await this.$router.push({path: this.topMenuCurrent.homeUrl, query: {}})
- }
},
// 鏂板缓璺敱
__addRouters (routes, parents = []) {
--
Gitblit v1.9.3