新增: 文件浏览器收尾(滚动条/阶段进度条/空状态/骨架屏/工程下拉)

- 提交之前未提交的滚动条与布局修复
- 移除阶段进度条死代码(模板+CSS+常量)
- 文件预览空状态加图标引导
- 变更视图加载骨架屏
- 工程选择器改为自定义下拉(显示工程路径)
This commit is contained in:
lxy
2026-06-30 21:45:31 +08:00
parent 78bd8d4344
commit 6b131f3dc1
4 changed files with 135 additions and 121 deletions
+25 -18
View File
@@ -35,7 +35,8 @@
<div class="preview-body">
<!-- 未选文件占位 -->
<div v-if="!filePath" class="preview-placeholder">
{{ $t('fileExplorer.selectFileHint') }}
<div class="preview-placeholder-icon">📄</div>
<div class="preview-placeholder-text">{{ $t('fileExplorer.selectFileHint') }}</div>
</div>
<!-- 加载中 -->
@@ -75,9 +76,9 @@
</div>
<!-- 文本/代码(highlight.js 语法高亮 + 行号; diff 模式时显示) -->
<div v-else class="preview-code-wrap">
<div class="preview-line-numbers" ref="lineNumRef">
<div v-for="n in lineCount" :key="n" class="preview-line-num" :class="{ 'is-active': n === activeLine }">{{ n }}</div>
<div v-else class="preview-code-scroll">
<div class="preview-line-numbers" aria-hidden="true">
<div v-for="n in lineCount" :key="n" class="preview-line-num">{{ n }}</div>
</div>
<pre class="preview-code"><code :class="hljsClass" v-html="htmlContent"></code></pre>
</div>
@@ -116,10 +117,6 @@ const lineCount = computed(() => {
return lines.length
})
/** 当前激活行(预留:后续可点击行号跳转/选中高亮)。 */
const activeLine = ref<number | null>(null)
const lineNumRef = ref<HTMLElement | null>(null)
/** Diff 显示控制 */
const showDiff = ref(false)
const diffContent = ref('')
@@ -398,6 +395,15 @@ onUnmounted(() => {
min-height: 200px;
}
.preview-placeholder-icon {
font-size: 48px;
opacity: 0.4;
}
.preview-placeholder-text {
font-size: 13px;
}
.preview-error { color: #e05050; }
.binary-icon { font-size: 32px; opacity: 0.5; }
@@ -423,24 +429,22 @@ onUnmounted(() => {
font-size: 12.5px;
line-height: 1.55;
white-space: pre;
overflow: auto;
overflow: visible;
tab-size: 2;
flex: 1;
min-width: 0;
min-height: 0;
}
.preview-code code { font-family: inherit; }
/* 行号 + 代码并排容器 */
.preview-code-wrap {
/* 行号 + 代码共享同一个滚动容器 */
.preview-code-scroll {
display: flex;
overflow: hidden;
flex: 1;
min-height: 0;
flex: 1 1 0;
overflow: auto;
}
/* 行号列 */
/* 行号列 — sticky 固定在左侧,跟随滚动容器一起滚 */
.preview-line-numbers {
flex-shrink: 0;
padding: 14px 0;
@@ -449,13 +453,16 @@ onUnmounted(() => {
background: rgba(255, 255, 255, 0.03);
border-right: 0.5px solid var(--df-border);
user-select: none;
overflow: hidden;
position: sticky;
left: 0;
z-index: 1;
align-self: flex-start;
}
.preview-line-num {
padding: 0 10px 0 8px;
font-family: var(--df-font-mono, 'Cascadia Code', Consolas, monospace);
font-size: 12px;
font-size: 12.5px;
line-height: 1.55;
color: var(--df-text-dim);
opacity: 0.5;