style: 添加tab的文本省略

This commit is contained in:
539943419 committed 2024-08-23 14:28:35 +08:00
1 parent 5719012c2c
commit f5e0bd4a56
2 files changed
+38 -22

No files matched your search

+37 -21
View File
@@ -50,10 +50,12 @@ const createView = (
views.splice( views.splice(
index, index,
0, 0,
reactive<VirtualPage>(new VirtualPage(component, { reactive<VirtualPage>(
directorys: [...(currentDirectorys ?? [])], new VirtualPage(component, {
files: [...(currentFiles ?? [])] directorys: [...(currentDirectorys ?? [])],
})) files: [...(currentFiles ?? [])]
})
)
) )
} }
@@ -117,19 +119,23 @@ onMounted(() => {
<template> <template>
<div class="view"> <div class="view">
<div class="view-controler"> <div class="view-controller">
<n-scrollbar x-scrollable> <n-scrollbar x-scrollable>
<div class="tags-container"> <div class="tabs-container">
<transition-group name="tab"> <transition-group name="tab">
<div <div
class="tab" class="tab"
v-for="(view, index) of views" v-for="(view, index) of views"
:key="view.uid"> :key="view.uid">
<div <span
class="tab-title" class="tab-title"
@click="handleClickTitle(index)"> @click="handleClickTitle(index)">
{{ view.title }} {{
</div> view.title.length > 5 && 0
? `${view.title.substring(0, 5)}...`
: view.title
}}
</span>
<div <div
class="tab-point" class="tab-point"
:style="{ backgroundColor: view.color }"></div> :style="{ backgroundColor: view.color }"></div>
@@ -206,7 +212,7 @@ onMounted(() => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
$controler-height: 25px; $controller-height: 25px;
$tag-width: 170px; $tag-width: 170px;
.view { .view {
@@ -214,14 +220,14 @@ $tag-width: 170px;
height: 100%; height: 100%;
width: 100%; width: 100%;
.view-controler { .view-controller {
display: flex; display: flex;
height: $controler-height; height: $controller-height;
width: 100%; width: 100%;
background-color: #dadada; background-color: #dadada;
// overflow: hidden; // overflow: hidden;
.tags-container { .tabs-container {
display: flex; display: flex;
margin-left: 5px; margin-left: 5px;
flex: 1; flex: 1;
@@ -230,6 +236,7 @@ $tag-width: 170px;
.tab { .tab {
position: relative; position: relative;
width: $tag-width; width: $tag-width;
height: $controller-height;
margin: 0 5px; margin: 0 5px;
// flex: 1; // flex: 1;
display: flex; display: flex;
@@ -237,10 +244,19 @@ $tag-width: 170px;
align-items: center; align-items: center;
.tab-title { .tab-title {
// font-family: monospace;
// font-weight: bolder;
margin-left: 4px; margin-left: 4px;
// width: 70%; width: 90px;
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
span {
user-select: none;
cursor: pointer;
}
} }
.tab-point { .tab-point {
@@ -263,7 +279,7 @@ $tag-width: 170px;
&:not(:last-child)::after { &:not(:last-child)::after {
content: ''; content: '';
height: calc($controler-height * 0.6); height: calc($controller-height * 0.6);
width: 1px; width: 1px;
border-right: 1px solid black; border-right: 1px solid black;
position: absolute; position: absolute;
@@ -288,7 +304,7 @@ $tag-width: 170px;
&::before { &::before {
content: ''; content: '';
height: calc($controler-height * 0.6); height: calc($controller-height * 0.6);
width: 1px; width: 1px;
border-right: 1px solid black; border-right: 1px solid black;
position: absolute; position: absolute;
@@ -297,8 +313,8 @@ $tag-width: 170px;
} }
.icon { .icon {
height: calc($controler-height * 0.7); height: calc($controller-height * 0.7);
width: calc($controler-height * 0.7); width: calc($controller-height * 0.7);
border-radius: 5px; border-radius: 5px;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -317,7 +333,7 @@ $tag-width: 170px;
position: relative; position: relative;
display: flex; display: flex;
// flex-direction: column; // flex-direction: column;
height: calc(100% - $controler-height); height: calc(100% - $controller-height);
overflow-y: overlay; overflow-y: overlay;
overflow-x: overlay; overflow-x: overlay;
@@ -351,8 +367,8 @@ $tag-width: 170px;
// transition动画相关 // transition动画相关
.view { .view {
.view-controler { .view-controller {
.tags-container { .tabs-container {
.tab-move, .tab-move,
.tab-enter-active { .tab-enter-active {
transition: all 0.2s ease; transition: all 0.2s ease;
@@ -6,7 +6,7 @@
<Icon class="item-main-icon" v-show="clientWidth > 250"></Icon> <Icon class="item-main-icon" v-show="clientWidth > 250"></Icon>
<div class="item-main-info"> <div class="item-main-info">
<div class="item-main-info-name"> <div class="item-main-info-name">
<Icon class="item-main-info-name-icon" v-show="clientWidth <= 250"></Icon> <Icon class="item-main-info-name-icon" v-if="clientWidth <= 250"></Icon>
<n-ellipsis style="max-width: 140px;">{{ name }}</n-ellipsis> <n-ellipsis style="max-width: 140px;">{{ name }}</n-ellipsis>
</div> </div>
<div class="item-main-info-date" v-if="time"> <div class="item-main-info-date" v-if="time">