创建浮动区

This commit is contained in:
zqm
2025-11-03 17:26:28 +08:00
parent c753155274
commit 7df715f612
2 changed files with 57 additions and 68 deletions

View File

@@ -4,28 +4,24 @@
<Area :WindowState="windowState" :showTitleBar="false" title="主区域" /> <Area :WindowState="windowState" :showTitleBar="false" title="主区域" />
<!-- 浮动区域列表 --> <!-- 浮动区域列表 -->
<div <Area
v-for="area in floatingAreas" v-for="area in floatingAreas"
:key="area.id" :key="area.id"
class="floating-area"
:style="{
left: area.x + 'px',
top: area.y + 'px',
width: area.width + 'px',
height: area.height + 'px'
}"
>
<Area
:id="area.id" :id="area.id"
:title="area.title" :title="area.title"
:WindowState="'正常'" :WindowState="area.WindowState"
:showTitleBar="true" :showTitleBar="area.showTitleBar"
:width="area.width" :width="area.width"
:height="area.height" :height="area.height"
:style="{
position: 'absolute',
left: area.x + 'px',
top: area.y + 'px',
zIndex: 10
}"
@close="onCloseFloatingArea(area.id)" @close="onCloseFloatingArea(area.id)"
/> />
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
@@ -44,6 +40,7 @@ let areaIdCounter = 1
// 添加新的浮动区域 // 添加新的浮动区域
const addFloatingArea = () => { const addFloatingArea = () => {
// 创建新的Area组件配置
const newArea = { const newArea = {
id: `floating-area-${areaIdCounter++}`, id: `floating-area-${areaIdCounter++}`,
title: `浮动区域 ${areaIdCounter - 1}`, title: `浮动区域 ${areaIdCounter - 1}`,
@@ -51,8 +48,8 @@ const addFloatingArea = () => {
y: 50 + (areaIdCounter - 2) * 20, y: 50 + (areaIdCounter - 2) * 20,
width: 300, width: 300,
height: 200, height: 200,
collapsed: false, WindowState: '正常',
toolbarExpanded: false showTitleBar: true
} }
floatingAreas.value.push(newArea) floatingAreas.value.push(newArea)
} }
@@ -106,15 +103,7 @@ defineExpose({
overflow: hidden; overflow: hidden;
} }
/* 浮动区域样式 */ /* 浮动区域样式已直接应用到Area组件 */
.floating-area {
position: absolute;
z-index: 10;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
background-color: #fff;
overflow: hidden;
}
/* 添加浮动区域按钮样式 */ /* 添加浮动区域按钮样式 */
.add-floating-btn { .add-floating-btn {