Fei_Xian_Lin_Ye_Fang_Huo/src/App.vue

97 lines
1.5 KiB
Vue
Raw Normal View History

2023-08-18 08:55:52 +08:00
<template>
<div id="app">
<router-view v-if="isRouterAlive"></router-view>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import {setToken} from "./utils/auth";
export default {
name: 'App',
computed: {
...mapGetters([
'oidcIsAuthenticated'
])
},
provide(){
return {
reload: this.reload
}
},
data(){
return {
isRouterAlive: true
}
},
methods: {
userLoaded: function(e) {
console.log('I am listening to the user loaded event in vuex-oidc', e.detail)
},
reload(){
this.isRouterAlive = false
this.$nextTick(function(){
this.isRouterAlive = true
})
},
},
mounted() {
window.addEventListener('vuexoidc:userLoaded', this.userLoaded)
},
destroyed() {
window.removeEventListener('vuexoidc:userLoaded', this.userLoaded)
}
}
</script>
<style>
.flex{
display: flex;
}
.flex-1{
flex: 1;
}
.jc-c{
justify-content: center;
}
.jc-sb{
justify-content: space-between;
}
.jc-e{
justify-content: end;
}
.ai-c{
align-items: center;
}
.column{
flex-direction: column;
}
.fc-w{
color: #fff;
}
.max-h{
height: 100%;
}
.max-w{
width: 100%;
}
.fz-16{
font-size: 16px;
}
.fz-14{
font-size: 14px;
}
.fz-10{
font-size: 10px;
}
.mr-1{
margin-right: 10px;
}
.mr-2{
margin-right: 20px;
}
.cursor{
cursor: pointer;
}
</style>