完善Panel组件:添加maximized属性以支持最大化/还原图标切换,确保填充满父容器

This commit is contained in:
zqm
2025-11-04 15:45:10 +08:00
parent 5629018e55
commit 2e1b25c53a

View File

@@ -19,14 +19,25 @@
</button>
<button class="button-icon p-[2px] rounded hover:opacity-100 opacity-80"
@click="onMaximize"
aria-label="最大化">
<!-- 最大化图标仅外框1px + 两行填充 -->
<svg class="icon-square-svg" width="11" height="11" viewBox="0 0 11 11" aria-hidden="true">
<rect x="0.5" y="0.5" width="10" height="10" fill="#cbd6ff" stroke="#8ea3d8" stroke-width="1" />
<rect x="3" y="3" width="5" height="1" fill="#b8c6ff" />
<!-- 下行采用更宽填充以贴近示例图 -->
<rect x="1" y="3" width="8.5" height="6.5" fill="#435d9c" />
</svg>
:aria-label="maximized ? '还原' : '最大化'">
<!-- 最大化图标 -->
<template v-if="!maximized">
<!-- 最大化图标外框 + 内部线条 -->
<svg class="icon-square-svg" width="11" height="11" viewBox="0 0 11 11" aria-hidden="true">
<rect x="0.5" y="0.5" width="10" height="10" fill="#cbd6ff" stroke="#8ea3d8" stroke-width="1" />
<rect x="1" y="1" width="9" height="9" fill="none" stroke="#b8c6ff" stroke-width="1" />
</svg>
</template>
<!-- 还原图标 -->
<template v-else>
<!-- 还原图标两个重叠的外框 -->
<svg class="icon-square-svg" width="11" height="11" viewBox="0 0 11 11" aria-hidden="true">
<!-- 第一个外框 -->
<rect x="0.5" y="2.5" width="6" height="6" fill="#cbd6ff" stroke="#8ea3d8" stroke-width="1" />
<!-- 第二个外框 -->
<rect x="3.5" y="0.5" width="6" height="6" fill="#cbd6ff" stroke="#8ea3d8" stroke-width="1" />
</svg>
</template>
</button>
<button class="button-icon p-[2px] rounded hover:opacity-100 opacity-80"
@click="onClose"
@@ -95,6 +106,10 @@ const props = defineProps({
toolbarExpanded: {
type: Boolean,
default: false
},
maximized: {
type: Boolean,
default: false
}
});
@@ -175,6 +190,10 @@ const onDragEnd = () => {
/* 面板基础样式 */
.panel {
border: 1px solid #c7d2ea;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
/* 图标样式优化 */