import useRouterStore, { type RouteStr } from '@/useRouterStore' import { computed, defineComponent, onMounted, onUnmounted, ref, Transition, watch } from 'vue' import { OhVueIcon, addIcons } from 'oh-vue-icons' import { MdClose, MdOpeninfull, MdClosefullscreen } from 'oh-vue-icons/icons' import asyncLoader from './utils/asyncLoader' import widgetList from '@/widgets' addIcons(MdClose, MdOpeninfull, MdClosefullscreen) const SearchPage = asyncLoader(() => import('@/layout/header/search/SearchPage')) const AdderPage = asyncLoader(() => import('@/layout/adder/AdderPage')) const BackgroundSwtich = asyncLoader(() => import('@/layout/background/BackgroundSwtich')) const fullList: RouteStr[] = [] export default defineComponent(() => { const router = useRouterStore() const show = computed( () => router.path.startsWith('widget-') || router.path === 'global-search' || router.path === 'global-adder' || router.path === 'global-background' ) const full = ref(false) watch(router, () => { full.value = false }) onMounted(() => { window.addEventListener('keydown', handleKeydown) }) onUnmounted(() => { // 清理事件监听 window.removeEventListener('keydown', handleKeydown) }) function handleKeydown(e: any) { if (e.key === 'Escape') { router.back() } } return () => (