import useRouterStore, { type RouteStr } from '@/useRouterStore' import { computed, defineComponent, 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' addIcons(MdClose, MdOpeninfull, MdClosefullscreen) const SearchPage = asyncLoader(() => import('@/layout/header/search/SearchPage')) const noFullList: RouteStr[] = ['global-search', 'global-adder'] export default defineComponent(() => { const router = useRouterStore() const show = computed( () => router.path.startsWith('widget-') || router.path === 'global-search' || router.path === 'global-adder' ) const full = ref(false) watch(router, () => { full.value = false }) return () => (
{/* 背景遮罩 */} {show.value && (
{ router.path = '' }} >
)}
{/* 弹框主体 */} {show.value && (
{/* 关闭按钮 */}
{ router.path = '' }} >
{/* 全屏按钮 */} {noFullList.includes(router.path) ? null : (
{ full.value = !full.value }} >
)}
{router.path === 'global-search' ? : null}
)}
) })