refactor: 优化切换组织和工作空间刷新页面

This commit is contained in:
Captain.B 2021-06-05 22:15:10 +08:00 committed by 刘瑞斌
parent 5f684676d1
commit 9dc0d30a9c
2 changed files with 16 additions and 6 deletions

View File

@ -5,7 +5,7 @@
<component :is="licenseHeader"></component> <component :is="licenseHeader"></component>
</el-col> </el-col>
</el-row> </el-row>
<el-row id="header-top" type="flex" justify="space-between" align="middle"> <el-row id="header-top" type="flex" justify="space-between" align="middle" v-if="isMenuShow">
<el-col :span="12"> <el-col :span="12">
<img :src="'/display/file/logo'" class="logo" alt=""> <img :src="'/display/file/logo'" class="logo" alt="">
<ms-top-menus :color="color"/> <ms-top-menus :color="color"/>
@ -53,6 +53,7 @@ export default {
color: '', color: '',
sessionTimer: null, sessionTimer: null,
isShow: true, isShow: true,
isMenuShow: true,
}; };
}, },
created() { created() {
@ -106,7 +107,8 @@ export default {
// //
provide() { provide() {
return { return {
reload: this.reload reload: this.reload,
reloadTopMenus: this.reloadTopMenus,
} }
}, },
methods: { methods: {
@ -147,11 +149,16 @@ export default {
reload() { reload() {
// //
this.isShow = false this.isShow = false
// $nextTick() DOM
this.$nextTick(() => { this.$nextTick(() => {
this.isShow = true this.isShow = true
}) })
},
reloadTopMenus() {
//
this.isMenuShow = false
this.$nextTick(() => {
this.isMenuShow = true
})
} }
}, },
components: { components: {

View File

@ -70,6 +70,9 @@ export default {
this.initMenuData(); this.initMenuData();
this.getCurrentUserInfo(); this.getCurrentUserInfo();
}, },
inject: [
'reloadTopMenus'
],
data() { data() {
return { return {
organizationList: [ organizationList: [
@ -154,7 +157,7 @@ export default {
// localStorage.removeItem(PROJECT_ID); // localStorage.removeItem(PROJECT_ID);
// } // }
this.$router.push('/').then(() => { this.$router.push('/').then(() => {
window.location.reload(); this.reloadTopMenus();
}).catch(err => err); }).catch(err => err);
}); });
}, },
@ -172,7 +175,7 @@ export default {
// localStorage.removeItem(PROJECT_ID); // localStorage.removeItem(PROJECT_ID);
// } // }
this.$router.push('/').then(() => { this.$router.push('/').then(() => {
window.location.reload(); this.reloadTopMenus();
}).catch(err => err); }).catch(err => err);
}); });
}, },