Commit 439b4cf3 by changjin

修改项目切换为局部杀心

parent ddda95e1
...@@ -76,6 +76,7 @@ export default { ...@@ -76,6 +76,7 @@ export default {
data: {}, data: {},
formData: {} formData: {}
}), }),
inject: ['reload'],
created () { created () {
this.projectId = window.sessionStorage.getItem('projectId') this.projectId = window.sessionStorage.getItem('projectId')
this.getData(this.projectId) this.getData(this.projectId)
...@@ -88,8 +89,6 @@ export default { ...@@ -88,8 +89,6 @@ export default {
return this.$route.matched.map(route => route.meta) return this.$route.matched.map(route => route.meta)
} }
}, },
update (){
},
methods: { methods: {
getData (projectId) { getData (projectId) {
if (projectId) { if (projectId) {
...@@ -97,6 +96,7 @@ export default { ...@@ -97,6 +96,7 @@ export default {
if(res.data.code === '0') { if(res.data.code === '0') {
this.data = res.data.data this.data = res.data.data
window.sessionStorage.setItem('projectId',projectId) window.sessionStorage.setItem('projectId',projectId)
this.reload()
} }
}) })
} else { } else {
...@@ -110,10 +110,7 @@ export default { ...@@ -110,10 +110,7 @@ export default {
}, },
// 选择项目 // 选择项目
choose (item) { choose (item) {
this.data.projectName = item.projectName
window.sessionStorage.setItem('projectId',item.id)
this.getData(item.id) this.getData(item.id)
window.location.reload()
}, },
// 退出登录 // 退出登录
loginout () { loginout () {
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<v-head></v-head> <v-head></v-head>
<v-sidebar></v-sidebar> <v-sidebar></v-sidebar>
<div class="content" v-if="pageNameList[1].pageName !== '外部系统管理' && pageNameList[1].pageName !== '首页'"> <div class="content" v-if="pageNameList[1].pageName !== '外部系统管理' && pageNameList[1].pageName !== '首页'">
<transition name="move" mode="out-in"><router-view></router-view></transition> <transition name="move" mode="out-in"><router-view v-if="isRouterAlive"></router-view></transition>
</div> </div>
<div class="content1" v-if="pageNameList[1].pageName == '外部系统管理' || pageNameList[1].pageName == '首页'"> <div class="content1" v-if="pageNameList[1].pageName == '外部系统管理' || pageNameList[1].pageName == '首页'">
<transition name="move" mode="out-in"><router-view></router-view></transition> <transition name="move" mode="out-in"><router-view v-if="isRouterAlive"></router-view></transition>
</div> </div>
</div> </div>
</template> </template>
...@@ -14,6 +14,16 @@ ...@@ -14,6 +14,16 @@
import vHead from './Header.vue' import vHead from './Header.vue'
import vSidebar from './Sidebar.vue' import vSidebar from './Sidebar.vue'
export default { export default {
data () {
return {
isRouterAlive: true
}
},
provide(){ //提供
return {
reload: this.reload
}
},
components: { components: {
vHead, vHead,
vSidebar vSidebar
...@@ -23,5 +33,13 @@ export default { ...@@ -23,5 +33,13 @@ export default {
return this.$route.matched.map(route => route.meta) return this.$route.matched.map(route => route.meta)
} }
}, },
methods: {
reload(){
this.isRouterAlive = false
this.$nextTick( function () {
this.isRouterAlive = true
})
}
}
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment