Commit 439b4cf3 by changjin

修改项目切换为局部杀心

parent ddda95e1
......@@ -76,6 +76,7 @@ export default {
data: {},
formData: {}
}),
inject: ['reload'],
created () {
this.projectId = window.sessionStorage.getItem('projectId')
this.getData(this.projectId)
......@@ -88,8 +89,6 @@ export default {
return this.$route.matched.map(route => route.meta)
}
},
update (){
},
methods: {
getData (projectId) {
if (projectId) {
......@@ -97,6 +96,7 @@ export default {
if(res.data.code === '0') {
this.data = res.data.data
window.sessionStorage.setItem('projectId',projectId)
this.reload()
}
})
} else {
......@@ -110,10 +110,7 @@ export default {
},
// 选择项目
choose (item) {
this.data.projectName = item.projectName
window.sessionStorage.setItem('projectId',item.id)
this.getData(item.id)
window.location.reload()
},
// 退出登录
loginout () {
......
......@@ -3,10 +3,10 @@
<v-head></v-head>
<v-sidebar></v-sidebar>
<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 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>
</template>
......@@ -14,6 +14,16 @@
import vHead from './Header.vue'
import vSidebar from './Sidebar.vue'
export default {
data () {
return {
isRouterAlive: true
}
},
provide(){ //提供
return {
reload: this.reload
}
},
components: {
vHead,
vSidebar
......@@ -23,5 +33,13 @@ export default {
return this.$route.matched.map(route => route.meta)
}
},
methods: {
reload(){
this.isRouterAlive = false
this.$nextTick( function () {
this.isRouterAlive = true
})
}
}
}
</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