diff --git a/frontend/src/components/MonacoDiff.vue b/frontend/src/components/MonacoDiff.vue
index 89a0b41..e6166e8 100644
--- a/frontend/src/components/MonacoDiff.vue
+++ b/frontend/src/components/MonacoDiff.vue
@@ -1,6 +1,7 @@
-
+
diff --git a/frontend/src/views/strategy/Code.vue b/frontend/src/views/strategy/Code.vue
index 6ea466a..0d37365 100644
--- a/frontend/src/views/strategy/Code.vue
+++ b/frontend/src/views/strategy/Code.vue
@@ -139,6 +139,7 @@ function runBacktest(): void {
const versions = ref([])
const versionsOpen = ref(false)
const diffCode = ref(null)
+const diffReady = ref(false)
const versionsLoading = ref(false)
async function openVersions(): Promise {
@@ -146,6 +147,7 @@ async function openVersions(): Promise {
versionsOpen.value = true
versionsLoading.value = true
diffCode.value = null
+ diffReady.value = false
try {
versions.value = await getCodeVersions(active.value.name)
} catch {
@@ -157,8 +159,12 @@ async function openVersions(): Promise {
async function showDiff(h8: string): Promise {
if (!active.value) return
+ diffReady.value = false
try {
diffCode.value = await getCodeVersion(active.value.name, h8)
+ // 抽屉展开动画(~300ms)期间容器宽为 0,Monaco diff 在其中创建会把左右分栏算死
+ // (左栏被压扁且事后 layout() 救不回)。等动画结束容器全宽后再挂载组件。
+ setTimeout(() => { diffReady.value = true }, 360)
} catch {
ElMessage.error('读取版本失败')
}
@@ -245,8 +251,8 @@ async function showDiff(h8: string): Promise {
{{ (v.size / 1024).toFixed(1) }} KB
-