修复TabPage标签布局:移除宽度限制并优化flex布局确保标题靠左、关闭按钮靠右

This commit is contained in:
zqm
2025-11-05 16:18:58 +08:00
parent f4524ad6fd
commit 86322dfaa8

View File

@@ -9,21 +9,17 @@
@click="setActiveTab(index)" @click="setActiveTab(index)"
> >
<div class="flex items-center justify-between w-full px-16"> <div class="flex items-center justify-between w-full px-16">
<div class="flex items-center"> <span class="tab-title">{{ panel.title }}</span>
<span class="tab-title">{{ panel.title }}</span> <button
</div> class="button-icon p-[2px] rounded hover:opacity-100 opacity-80"
<div class="tab-buttons flex items-center"> @click.stop="closeTab(panel.id)"
<button aria-label="关闭"
class="button-icon p-[2px] rounded hover:opacity-100 opacity-80" >
@click.stop="closeTab(panel.id)" <svg width="11" height="11" viewBox="0 0 11 11" aria-hidden="true">
aria-label="关闭" <line x1="2" y1="2" x2="9" y2="9" stroke="#e6efff" stroke-width="1" />
> <line x1="2" y1="9" x2="9" y2="2" stroke="#e6efff" stroke-width="1" />
<svg width="11" height="11" viewBox="0 0 11 11" aria-hidden="true"> </svg>
<line x1="2" y1="2" x2="9" y2="9" stroke="#e6efff" stroke-width="1" /> </button>
<line x1="2" y1="9" x2="9" y2="2" stroke="#e6efff" stroke-width="1" />
</svg>
</button>
</div>
</div> </div>
</div> </div>
<div class="tab-placeholder"></div> <div class="tab-placeholder"></div>
@@ -104,8 +100,6 @@ const closeTab = (tabId) => {
} }
.tab-item { .tab-item {
display: flex;
align-items: center;
height: 26px; height: 26px;
margin-left: 1px; margin-left: 1px;
background: linear-gradient(to bottom, var(--vs-blue-top), var(--vs-blue-bottom)); background: linear-gradient(to bottom, var(--vs-blue-top), var(--vs-blue-bottom));
@@ -120,11 +114,13 @@ const closeTab = (tabId) => {
} }
.tab-title { .tab-title {
flex: 1;
text-align: left; text-align: left;
min-width: 0; min-width: 0;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
margin-right: 8px;
} }
.tab-item.active { .tab-item.active {
@@ -146,10 +142,7 @@ const closeTab = (tabId) => {
color: #333; color: #333;
} }
.tab-buttons {
display: flex;
align-items: center;
}
.button-icon { .button-icon {
background: transparent; background: transparent;