2020-09-27 22:27:25 +08:00
|
|
|
<template>
|
2021-04-06 01:31:09 +08:00
|
|
|
<n-layout :position="isXs ? undefined : 'absolute'" class="root-layout">
|
2021-01-12 23:05:51 +08:00
|
|
|
<site-header />
|
2020-12-12 13:51:22 +08:00
|
|
|
<n-layout
|
|
|
|
class="home-layout"
|
2021-04-06 01:31:09 +08:00
|
|
|
:style="isXs ? undefined : 'top: 64px; overflow: hidden'"
|
|
|
|
:position="isXs ? undefined : 'absolute'"
|
2020-12-12 13:51:22 +08:00
|
|
|
>
|
2020-09-27 22:27:25 +08:00
|
|
|
<router-view />
|
|
|
|
</n-layout>
|
|
|
|
</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'
|
2021-04-06 01:31:09 +08:00
|
|
|
import { useIsXs } 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()
|
2021-04-06 01:31:09 +08:00
|
|
|
const isXsRef = useIsXs()
|
2021-01-13 12:01:02 +08:00
|
|
|
onMounted(() => {
|
|
|
|
loadingBarApiRef.value = loadingBar
|
|
|
|
loadingBar.finish()
|
2021-03-15 16:37:18 +08:00
|
|
|
const memoedHash = window.location.hash
|
|
|
|
if (memoedHash) {
|
|
|
|
// scroll to hashed element
|
|
|
|
window.location.hash = ''
|
|
|
|
window.location.hash = memoedHash
|
|
|
|
}
|
2021-01-13 12:01:02 +08:00
|
|
|
})
|
2021-04-05 19:40:49 +08:00
|
|
|
return {
|
2021-04-06 01:31:09 +08:00
|
|
|
isXs: isXsRef
|
2021-04-05 19:40:49 +08:00
|
|
|
}
|
2020-09-27 22:27:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|