使用相对定位优化TabPage标签布局:标题靠左、关闭按钮绝对定位靠右
This commit is contained in:
@@ -8,10 +8,10 @@
|
|||||||
:class="['tab-item', { 'active': activeTabIndex === index }]"
|
:class="['tab-item', { 'active': activeTabIndex === index }]"
|
||||||
@click="setActiveTab(index)"
|
@click="setActiveTab(index)"
|
||||||
>
|
>
|
||||||
<div class="flex w-full justify-between items-center">
|
<div class="relative w-full">
|
||||||
<span class="tab-title">{{ panel.title }}</span>
|
<span class="tab-title">{{ panel.title }}</span>
|
||||||
<button
|
<button
|
||||||
class="button-icon p-[2px] rounded hover:opacity-100 opacity-80"
|
class="button-icon p-[2px] rounded hover:opacity-100 opacity-80 absolute right-0"
|
||||||
@click.stop="closeTab(panel.id)"
|
@click.stop="closeTab(panel.id)"
|
||||||
aria-label="关闭"
|
aria-label="关闭"
|
||||||
>
|
>
|
||||||
@@ -123,7 +123,7 @@ const closeTab = (tabId) => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex: 1;
|
margin-right: 20px; /* 为关闭按钮留出空间 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item.active {
|
.tab-item.active {
|
||||||
|
|||||||
Reference in New Issue
Block a user