<template>
  <loading v-if="show" />
  <n-config-provider
    preflight-style-disabled
    inline-theme-disabled
    :theme="theme"
    :locale="zhCN"
    :date-locale="dateZhCN"
    abstract
  >
    <n-notification-provider>
      <n-layout>
        <router-view />
      </n-layout>
    </n-notification-provider>
  </n-config-provider>
</template>
<script setup lang='ts'>
import loading from '@/components/loading.vue'
import useStore from '@/store/index'
import { computed } from 'vue'
import {
  zhCN, dateZhCN, darkTheme, lightTheme, useOsTheme
} from 'naive-ui'

const osTheme = useOsTheme()
const store = useStore()
const show = computed(() => store.loading)
const theme = computed(() => (osTheme.value !== 'dark' ? darkTheme : lightTheme))
</script>
<style>
@import './assets/global.css';
</style>