mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.0 KiB
51 lines
1.0 KiB
<script lang="ts" setup> |
|
import { useTitle } from '@vueuse/core' |
|
import { useI18n, useRoute, useSidebar } from '#imports' |
|
|
|
const route = useRoute() |
|
|
|
const { te, t } = useI18n() |
|
|
|
const { hasSidebar } = useSidebar('nc-left-sidebar') |
|
|
|
const refreshSidebar = ref(false) |
|
|
|
const sidebarReady = ref(false) |
|
|
|
useTitle(route.meta?.title && te(route.meta.title) ? `${t(route.meta.title)}` : 'NocoDB') |
|
|
|
watch(hasSidebar, (val) => { |
|
if (!val) { |
|
refreshSidebar.value = true |
|
nextTick(() => { |
|
refreshSidebar.value = false |
|
}) |
|
} |
|
}) |
|
|
|
onMounted(() => { |
|
until(() => document.querySelector('#nc-sidebar-left')) |
|
.toBeTruthy() |
|
.then(() => { |
|
sidebarReady.value = true |
|
}) |
|
}) |
|
</script> |
|
|
|
<script lang="ts"> |
|
export default { |
|
name: 'DefaultLayout', |
|
} |
|
</script> |
|
|
|
<template> |
|
<div class="w-full h-full"> |
|
<Teleport v-if="sidebarReady" :to="hasSidebar ? '#nc-sidebar-left' : null" :disabled="!hasSidebar"> |
|
<slot v-if="!refreshSidebar" name="sidebar" /> |
|
</Teleport> |
|
|
|
<a-layout-content> |
|
<slot /> |
|
</a-layout-content> |
|
</div> |
|
</template>
|
|
|