25 lines
765 B
Vue
25 lines
765 B
Vue
<script setup lang="ts">
|
|
import { computed, watchEffect } from 'vue'
|
|
import { RouterView, useRoute } from 'vue-router'
|
|
import { documentTitleForRoute } from './app/pageTitle'
|
|
import AppShell from './components/shell/AppShell.vue'
|
|
|
|
const route = useRoute()
|
|
const inShell = computed(() => route.meta.shell === true)
|
|
|
|
watchEffect(() => {
|
|
document.title = documentTitleForRoute(route)
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<!-- Keyed by path, not full path: a new controller or record remounts its
|
|
view, while list query changes (search, sort, page) keep it. -->
|
|
<AppShell v-if="inShell">
|
|
<RouterView v-slot="{ Component, route: current }">
|
|
<component :is="Component" :key="current.path" />
|
|
</RouterView>
|
|
</AppShell>
|
|
<RouterView v-else />
|
|
</template>
|