diff --git a/frontend/src/views/strategy/Code.vue b/frontend/src/views/strategy/Code.vue index f3a8ee8..dc60618 100644 --- a/frontend/src/views/strategy/Code.vue +++ b/frontend/src/views/strategy/Code.vue @@ -26,11 +26,15 @@ const syntaxOk = ref(null) const active = computed(() => files.value.find((f) => f.name === activeName.value)) -// 文件树按类型分组:组合策略在前(常用),个股策略在后 +// 文件树按类型分组:组合策略在前(常用),个股策略在后;组头可点击折叠/展开 const fileGroups = computed(() => [ { label: '组合策略', items: files.value.filter((f) => f.type === 'portfolio') }, { label: '个股策略', items: files.value.filter((f) => f.type !== 'portfolio') }, ].filter((g) => g.items.length)) +const collapsed = ref>({}) +function toggleGroup(label: string): void { + collapsed.value = { ...collapsed.value, [label]: !collapsed.value[label] } +} onMounted(async () => { try { @@ -122,12 +126,14 @@ function runBacktest(): void { 策略文件