保存一下
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
<template>
|
||||
<n-config-provider :config-provider-props="configProviderProps" class="w-full h-full pos-relative">
|
||||
<n-config-provider
|
||||
:config-provider-props="configProviderProps"
|
||||
class="w-full h-full pos-relative"
|
||||
>
|
||||
<div ref="desktopRootDom" class="desktop-root">
|
||||
<div class="desktop-container">
|
||||
<div v-for="icon in iconArr" class="icon-container">{{ icon.icon }}</div>
|
||||
<div v-for="icon in iconArr" class="icon-container"
|
||||
:style="`grid-row: ${icon.row}/${icon.row + 1};grid-column: ${icon.col}/${icon.col + 1}};`">{{ icon.icon }}</div>
|
||||
</div>
|
||||
<div class="task-bar"></div>
|
||||
</div>
|
||||
@@ -16,12 +20,14 @@ 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 { useIconDrag } from '@/core/desktop/utils/useIconDrag.ts'
|
||||
import { onMounted } from 'vue'
|
||||
import { onMounted, ref, useTemplateRef, watchEffect } from 'vue'
|
||||
import type { IconType } from '@/core/desktop/types/IconType.ts'
|
||||
import { useDesktopInit } from '@/core/desktop/ui/useDesktopInit.ts'
|
||||
|
||||
const props = defineProps<{process: DesktopProcess}>()
|
||||
console.log(props.process)
|
||||
const props = defineProps<{ process: DesktopProcess }>()
|
||||
// console.log(props.process)
|
||||
|
||||
const { colCount, rowCount } = useDesktopInit('.desktop-container')
|
||||
|
||||
const iconArr: IconType[] = [
|
||||
{
|
||||
@@ -29,35 +35,42 @@ const iconArr: IconType[] = [
|
||||
icon: '🗂',
|
||||
path: '/',
|
||||
col: 1,
|
||||
row: 1
|
||||
row: 1,
|
||||
},
|
||||
{
|
||||
name: '浏览器',
|
||||
icon: '🌐',
|
||||
path: '/',
|
||||
col: 1,
|
||||
row: 2
|
||||
row: 2,
|
||||
},
|
||||
{
|
||||
name: '记事本',
|
||||
icon: '📄',
|
||||
path: '/',
|
||||
col: 1,
|
||||
row: 3
|
||||
row: 3,
|
||||
},
|
||||
{
|
||||
name: '音乐播放器',
|
||||
icon: '🎵',
|
||||
path: '/',
|
||||
col: 1,
|
||||
row: 4
|
||||
}
|
||||
row: 4,
|
||||
},
|
||||
]
|
||||
|
||||
XSystem.instance.eventManages.addEventListener(DesktopEventEnum.onDesktopRootDomResize, (width, height) => {
|
||||
console.log(width, height)
|
||||
notificationApi.create({ title: '桌面通知', content: `桌面尺寸变化${width}x${height}}`, duration: 2000 })
|
||||
})
|
||||
XSystem.instance.eventManages.addEventListener(
|
||||
DesktopEventEnum.onDesktopRootDomResize,
|
||||
(width, height) => {
|
||||
console.log(width, height)
|
||||
notificationApi.create({
|
||||
title: '桌面通知',
|
||||
content: `桌面尺寸变化${width}x${height}}`,
|
||||
duration: 2000,
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
const iconsInit = () => {
|
||||
const icons = document.querySelectorAll<HTMLDivElement>('div.icon-container')
|
||||
@@ -66,13 +79,6 @@ const iconsInit = () => {
|
||||
useIconDrag(icon, container)
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
const container = document.querySelector<HTMLDivElement>('.desktop-container')!
|
||||
console.log(container.getBoundingClientRect())
|
||||
// iconsInit()
|
||||
const { col, row } = useDesktopInit(container)
|
||||
console.log(col.value, row.value)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user