@primary: #1677ff; .pageTabsMain { display: flex; align-items: center; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; &::-webkit-scrollbar { height: 0; } .tabItem { position: relative; display: flex; align-items: center; height: 100%; user-select: none; transition: all 0.15s ease; &:not(:first-child) { margin-left: -9px; } &:global(:not(.dragging)) { cursor: pointer; } &:not(.tabItemActive) { &:hover { > .divider { opacity: 0; } & + .tabItem { > .divider { opacity: 0; } } .tabContent { background-color: rgba(0, 0, 0, 0.06); } } .tabClose:hover { color: rgba(0, 0, 0, 0.85); } } &.tabItemActive { z-index: 2; & + .tabItem { > .divider { opacity: 0 !important; } } .tabTitle { color: @primary; font-weight: 500; } .tabBg { &.tabBgActive { .tabBgInner { background-color: fade(@primary, 8%); } .tabBgCurveBefore, .tabBgCurveAfter { fill: fade(@primary, 8%); } } } } } .divider { position: absolute; left: 7px; top: 50%; z-index: 0; width: 1px; height: 16px; background-color: #e8e8e8; transform: translateY(-50%); transition: opacity 0.15s; } .tabBg { position: absolute; top: 0; left: 0; z-index: -1; width: 100%; height: 100%; padding: 0 calc(7px - 1px); transition: opacity 0.15s; } .tabBgInner { height: 100%; border-radius: 7px 7px 0 0; transition: background-color 0.15s, margin 0.15s, border-radius 0.15s; } .tabBgCurveBefore { position: absolute; left: -1px; bottom: 0; fill: transparent; transition: fill 0.15s; } .tabBgCurveAfter { position: absolute; right: -1px; bottom: 0; fill: transparent; transition: fill 0.15s; } // 仅包裹文字 + 关闭按钮,通过 margin 收在 tab 内部 .tabContent { position: relative; height: 28px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; width: fit-content; max-width: 100%; margin: 0 10px 0 10px; padding: 2px 2px 2px 8px; border-radius: 8px; transition: background-color 0.35s; } .tabTitle { min-width: 0; font-size: 13px; color: rgba(0, 0, 0, 0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tabClose { flex-shrink: 0; width: 16px; height: 16px; line-height: 16px; font-size: 10px; text-align: center; color: rgba(0, 0, 0, 0.45); border-radius: 50%; cursor: pointer; transition: all 0.15s; } }