fix(strategy): 编辑器加载文件误标未保存(code程序化赋值触发watch置dirty,运行回测被拦);select后nextTick复位 [nas]
CI/CD / test (push) Successful in 14s
CI/CD / nas-deploy (push) Successful in 27s
CI/CD / nas-verify (push) Successful in 9s

This commit is contained in:
2026-08-13 23:19:58 +08:00
parent 6728872d72
commit f0a0e6bc8a
+6 -1
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue'
import { ref, computed, onMounted, watch, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import MonacoEditor from '@/components/MonacoEditor.vue'
@@ -61,8 +61,13 @@ async function select(f: StrategyFile): Promise<void> {
try {
const { data } = await apiClient.get<{ code: string }>(`/strategy/file/${f.name}`)
code.value = data.code
// 程序化赋值会触发 watch(code) 误标 dirty → 渲染后复位
await nextTick()
dirty.value = false
} catch {
code.value = ''
await nextTick()
dirty.value = false
ElMessage.error(`读取 ${f.name} 失败`)
} finally {
loadingCode.value = false