diff --git a/src/layout/components/tags.vue b/src/layout/components/tags.vue index 9cb3d76d..5c0a6718 100644 --- a/src/layout/components/tags.vue +++ b/src/layout/components/tags.vue @@ -76,7 +76,7 @@ }, watch: { $route(e) { - this.addViewTags(e) + this.addViewTags(e); }, contextMenuVisible(value) { var _this = this; @@ -137,10 +137,22 @@ //TAB 刷新 refreshTab(){ var nowTag = this.contextMenuItem; - this.$router.push({ - path: nowTag.path - }) this.contextMenuVisible = false + //判断是否当前路由,否的话跳转 + if(this.$route.path != nowTag.path){ + this.$router.push({ + path: nowTag.path + }) + } + var _this = this; + setTimeout(function() { + _this.$store.commit("removeKeepLive", nowTag.name) + _this.$store.commit("setRouteShow", false) + _this.$nextTick(() => { + _this.$store.commit("pushKeepLive",nowTag.name) + _this.$store.commit("setRouteShow", true) + }) + }, 0); }, //TAB 关闭 closeTabs(){ diff --git a/src/store/modules/keepAlive.js b/src/store/modules/keepAlive.js index 997f1b54..c143cf51 100644 --- a/src/store/modules/keepAlive.js +++ b/src/store/modules/keepAlive.js @@ -1,6 +1,8 @@ export default { state: { - keepLiveRoute: [] + keepLiveRoute: [], + routeKey: null, + routeShow: true }, mutations: { pushKeepLive(state, component){ @@ -16,6 +18,17 @@ export default { }, clearKeepLive(state){ state.keepLiveRoute = [] + }, + setRouteKey(state, key){ + state.routeKey = key + }, + setRouteShow(state, key){ + state.routeShow = key + } + }, + actions: { + setRouteKey({ commit }, key) { + commit('setRouteKey', key); } } } diff --git a/src/views/home.vue b/src/views/home.vue index 7b4f891c..d9ad516d 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -52,6 +52,9 @@ return { } + }, + mounted(){ + console.log("home.vue mounted #57"); } } diff --git a/src/views/list.vue b/src/views/list.vue index 84339419..db9570e5 100644 --- a/src/views/list.vue +++ b/src/views/list.vue @@ -23,7 +23,7 @@ - + @@ -82,14 +82,21 @@ ], tableHeight: '0', tableData: [], + loading: true, drawer: false } }, components: { Show }, - created() { - this.tableData = this.$TOOL.data.get("user").menuList; + async created() { + var userInfo = await this.$API.user.info(); + var _this = this; + setTimeout(function() { + _this.tableData = userInfo.data.menuList; + _this.loading = false; + }, 500); + }, mounted(){ this.$nextTick(() => { diff --git a/src/views/other/empty.vue b/src/views/other/empty.vue index a5d59672..3e42a037 100644 --- a/src/views/other/empty.vue +++ b/src/views/other/empty.vue @@ -1,7 +1,7 @@ @@ -10,11 +10,8 @@ export default { data() { return { - keepAliveNameList: this.$store.state.keepAlive.keepLiveRoute + } - }, - created: function() { - - }, + } }