2021-01-16 00:54:31 +08:00
|
|
|
<template>
|
|
|
|
<component :is="layout">
|
2021-01-22 03:38:17 +08:00
|
|
|
<!-- <div class="text-center">Flash Messages will come here.</div> -->
|
2021-01-16 00:54:31 +08:00
|
|
|
<router-view />
|
|
|
|
</component>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-12-01 06:11:13 +08:00
|
|
|
import { defineComponent, computed } from 'vue';
|
|
|
|
import { useRouter } from 'vue-router';
|
2021-12-06 00:37:33 +08:00
|
|
|
import { useStore } from 'vuex';
|
2021-12-01 06:11:13 +08:00
|
|
|
const defaultLayout = 'default';
|
2021-12-06 00:37:33 +08:00
|
|
|
import { ActionTypes } from './store/actions'
|
2021-04-09 06:37:58 +08:00
|
|
|
|
2021-12-01 06:11:13 +08:00
|
|
|
export default defineComponent({
|
|
|
|
setup() {
|
2021-12-06 00:37:33 +08:00
|
|
|
const store = useStore();
|
|
|
|
|
|
|
|
if (window.performance.getEntriesByType('navigation').map((nav: any) => nav.type).includes('reload')) {
|
|
|
|
store.dispatch(ActionTypes.PERSIST_AUTH_FROM_LOCAL_STORAGE)
|
|
|
|
}
|
|
|
|
|
2021-12-01 06:11:13 +08:00
|
|
|
const { currentRoute } = useRouter();
|
2021-10-23 18:51:28 +08:00
|
|
|
|
2021-12-01 06:11:13 +08:00
|
|
|
const layout = computed(() => `${currentRoute.value.meta.layout || defaultLayout}-layout`);
|
2021-04-09 06:37:58 +08:00
|
|
|
|
2021-12-01 06:11:13 +08:00
|
|
|
return {
|
|
|
|
layout,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2021-01-16 00:54:31 +08:00
|
|
|
</script>
|