参考Panel标题栏实现,重构TabPage标签布局:添加容器结构确保标题靠左显示、关闭按钮靠右显示
This commit is contained in:
@@ -8,7 +8,10 @@
|
||||
:class="['tab-item', { 'active': activeTabIndex === index }]"
|
||||
@click="setActiveTab(index)"
|
||||
>
|
||||
<div class="tab-title-container">
|
||||
<div class="tab-title">{{ panel.title }}</div>
|
||||
</div>
|
||||
<div class="tab-buttons">
|
||||
<button
|
||||
class="button-icon p-[2px] rounded hover:opacity-100 opacity-80"
|
||||
@click.stop="closeTab(panel.id)"
|
||||
@@ -20,6 +23,7 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-placeholder"></div>
|
||||
</div>
|
||||
<!-- Tab页内容区域 -->
|
||||
@@ -116,6 +120,11 @@ const closeTab = (tabId) => {
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.tab-title-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tab-title {
|
||||
text-align: left;
|
||||
min-width: 0;
|
||||
@@ -126,6 +135,11 @@ const closeTab = (tabId) => {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.tab-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background: #ffffff;
|
||||
border: 1px solid #c7d2ea;
|
||||
@@ -146,7 +160,6 @@ const closeTab = (tabId) => {
|
||||
}
|
||||
|
||||
.button-icon {
|
||||
margin-right: -8px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
||||
Reference in New Issue
Block a user