2025-08-19 14:56:38 +08:00
|
|
|
<template>
|
2025-08-19 16:59:58 +08:00
|
|
|
<n-config-provider
|
|
|
|
|
:config-provider-props="configProviderProps"
|
|
|
|
|
class="w-full h-full pos-relative"
|
|
|
|
|
>
|
2025-08-22 15:49:10 +08:00
|
|
|
<div class="desktop-root" @contextmenu="onContextMenu">
|
|
|
|
|
<div class="w-full h-full flex-1 p-2 pos-relative">
|
|
|
|
|
<div class="desktop-container"
|
|
|
|
|
:style="gridStyle">
|
|
|
|
|
<AppIcon v-for="(appIcon, i) in appIconsRef" :key="i"
|
|
|
|
|
:icon="appIcon" :gridTemplate="gridTemplate" />
|
|
|
|
|
</div>
|
2025-08-19 14:56:38 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="task-bar"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</n-config-provider>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { DesktopProcess } from '@/core/desktop/DesktopProcess.ts'
|
|
|
|
|
import XSystem from '@/core/XSystem.ts'
|
|
|
|
|
import { notificationApi } from '@/core/common/naive-ui/discrete-api.ts'
|
|
|
|
|
import { configProviderProps } from '@/core/common/naive-ui/theme.ts'
|
|
|
|
|
import { DesktopEventEnum } from '@/core/events/EventTypes.ts'
|
|
|
|
|
import { useDesktopInit } from '@/core/desktop/ui/useDesktopInit.ts'
|
2025-08-21 16:57:42 +08:00
|
|
|
import AppIcon from '@/core/desktop/ui/components/AppIcon.vue'
|
2025-08-19 14:56:38 +08:00
|
|
|
|
2025-08-19 16:59:58 +08:00
|
|
|
const props = defineProps<{ process: DesktopProcess }>()
|
|
|
|
|
|
2025-08-21 16:57:42 +08:00
|
|
|
const { appIconsRef, gridStyle, gridTemplate } = useDesktopInit('.desktop-container')
|
2025-08-19 14:56:38 +08:00
|
|
|
|
2025-08-19 16:59:58 +08:00
|
|
|
XSystem.instance.eventManages.addEventListener(
|
|
|
|
|
DesktopEventEnum.onDesktopRootDomResize,
|
|
|
|
|
(width, height) => {
|
|
|
|
|
console.log(width, height)
|
|
|
|
|
notificationApi.create({
|
|
|
|
|
title: '桌面通知',
|
|
|
|
|
content: `桌面尺寸变化${width}x${height}}`,
|
|
|
|
|
duration: 2000,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
)
|
2025-08-19 14:56:38 +08:00
|
|
|
|
2025-08-22 15:49:10 +08:00
|
|
|
const onContextMenu = (e: MouseEvent) => {
|
|
|
|
|
e.preventDefault()
|
2025-08-19 14:56:38 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.desktop-root {
|
|
|
|
|
@apply w-full h-full flex flex-col;
|
|
|
|
|
|
|
|
|
|
.desktop-container {
|
2025-08-22 15:49:10 +08:00
|
|
|
@apply w-full h-full flex-1 grid grid-auto-flow-col pos-relative;
|
2025-08-19 14:56:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.task-bar {
|
|
|
|
|
@apply w-full h-[40px] bg-gray-200;
|
2025-08-20 09:59:19 +08:00
|
|
|
flex-shrink: 0;
|
2025-08-19 14:56:38 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|