naive-ui/demo/Site.vue

33 lines
701 B
Vue
Raw Normal View History

2020-09-27 22:27:25 +08:00
<template>
<n-layout :position="isMobile ? 'static' : 'absolute'" class="root-layout">
<site-header />
2021-05-26 14:39:33 +08:00
<router-view />
2020-09-27 22:27:25 +08:00
</n-layout>
</template>
<script>
2021-04-18 20:01:19 +08:00
import { onMounted } from 'vue'
import { useLoadingBar } from 'naive-ui'
2020-09-27 22:27:25 +08:00
import SiteHeader from './SiteHeader.vue'
import { loadingBarApiRef } from './routes/router'
import { useIsMobile } from './utils/composables'
2020-09-27 22:27:25 +08:00
export default {
name: 'Site',
2020-11-03 15:10:29 +08:00
components: {
SiteHeader
},
2021-01-13 12:01:02 +08:00
setup () {
2021-04-18 20:01:19 +08:00
const loadingBar = useLoadingBar()
const isMobileRef = useIsMobile()
2021-01-13 12:01:02 +08:00
onMounted(() => {
loadingBarApiRef.value = loadingBar
loadingBar.finish()
})
return {
isMobile: isMobileRef
}
2020-09-27 22:27:25 +08:00
}
}
</script>