This commit is contained in:
sakuya 2021-04-25 01:00:05 +08:00
parent e56e0a4dbb
commit 49fc8520b5
5 changed files with 47 additions and 15 deletions

View File

@ -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(){

View File

@ -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);
}
}
}

View File

@ -52,6 +52,9 @@
return {
}
},
mounted(){
console.log("home.vue mounted #57");
}
}
</script>

View File

@ -23,7 +23,7 @@
</el-header>
<el-main id="tableMain">
<el-card shadow="never">
<el-card shadow="never" v-loading="loading">
<el-table :data="tableData" row-key="name" stripe default-expand-all :height="tableHeight">
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="显示名称" prop="meta.title" width="200"></el-table-column>
@ -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(() => {

View File

@ -1,7 +1,7 @@
<template>
<router-view v-slot="{ Component }">
<keep-alive :include="keepAliveNameList">
<component :is="Component" :key="$route.fullPath"/>
<keep-alive :include="this.$store.state.keepAlive.keepLiveRoute">
<component :is="Component" :key="$route.fullPath" v-if="$store.state.keepAlive.routeShow"/>
</keep-alive>
</router-view>
</template>
@ -10,11 +10,8 @@
export default {
data() {
return {
keepAliveNameList: this.$store.state.keepAlive.keepLiveRoute
}
},
created: function() {
},
}
}
}
</script>