gerson
2024-06-30 bb195ab3dbdaecc8f4c6db0b4cecde6854ad0206
src/layout/main/classic.vue
@@ -5,14 +5,29 @@
</template>
<script setup lang="ts" name="layoutClassic">
import { defineAsyncComponent, computed, ref, watch, nextTick, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import { computed, defineAsyncComponent, nextTick, onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { PostLogin } from '/@/api/ai/user';
import { useThemeConfig } from '/@/stores/themeConfig';
const login = () => {
   return PostLogin({
      user: 'tc',
      pass: 'a',
   });
};
// 引入组件
const LayoutMain = defineAsyncComponent(() => import('/@/layout/component/main.vue'));
const LayoutMain = defineAsyncComponent(async () => {
   try {
      await login();
   } finally {
      // eslint-disable-next-line no-unsafe-finally
      return import('/@/layout/component/main.vue');
   }
});
// 定义变量内容
const layoutMainRef = ref<InstanceType<typeof LayoutMain>>();