<template>
  <el-config-provider :locale="appStore.locale" :size="appStore.size">
    <router-view />
  </el-config-provider>
  <PrintView ref="printView" />
</template>

<script setup lang="ts">
import useSettingsStore from '@/store/modules/settings';
import { handleThemeStyle } from '@/utils/theme';
import useAppStore from '@/store/modules/app';
import PrintView from '@/views/print/view.vue';

const appStore = useAppStore();
const printView = ref();
const internalInstance = getCurrentInstance();

onMounted(() => {
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(useSettingsStore().theme);
    if (internalInstance) {
      internalInstance.appContext.config.globalProperties.$openPrint = printView.value.openPrint;
    }
  });
});
</script>
