mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 22:44:22 +08:00
release: v1.17.10 — 一键寻优「查看」跳转携带完整行情上下文
- SymbolPicker code/category/startDate/endDate 改 defineModel 双向同步 - OptimizeView 两个「查看」按钮跳转 URL 附带 symbol/startDate/endDate/category - BacktestView onMounted 回填标的/周期/日期到 SymbolPicker 表单 - 向后兼容:老 URL(只有 strategy/params) 仍正常,缺失字段保持默认 - 前端 vue-tsc / vite build 通过,后端 870 单测全绿(无回归)
This commit is contained in:
@@ -13,17 +13,22 @@ import type { Category } from '../types'
|
||||
|
||||
const store = useBacktestStore()
|
||||
|
||||
const code = ref('000001')
|
||||
const category = ref<Category>('DAY')
|
||||
|
||||
// 日期默认:结束=今天,开始=3年前
|
||||
function isoDaysFromNow(days: number): string {
|
||||
const d = new Date()
|
||||
d.setDate(d.getDate() + days)
|
||||
return d.toISOString().slice(0, 10)
|
||||
}
|
||||
const endDate = ref(isoDaysFromNow(0))
|
||||
const startDate = ref(isoDaysFromNow(-365 * 3))
|
||||
// 代码 / 周期 / 日期通过 defineModel 与父组件双向同步:
|
||||
// 既允许父组件读取(如寻优页「查看」按钮拼 URL 带上这些值),
|
||||
// 也允许父组件写入(如回测页从 URL query 回填表单)。
|
||||
// 未绑定时取默认值,向后兼容。
|
||||
//
|
||||
// 注意:defineModel 的 default 不能引用本 <script setup> 内声明的局部函数
|
||||
// (编译期会被 hoist 到 setup() 外,此时函数还未定义),
|
||||
// 因此日期默认值用内联字面量表达式计算。
|
||||
const code = defineModel<string>('code', { default: '000001' })
|
||||
const category = defineModel<Category>('category', { default: 'DAY' })
|
||||
const startDate = defineModel<string>('startDate', {
|
||||
default: new Date(Date.now() - 365 * 3 * 86400_000).toISOString().slice(0, 10),
|
||||
})
|
||||
const endDate = defineModel<string>('endDate', {
|
||||
default: new Date().toISOString().slice(0, 10),
|
||||
})
|
||||
|
||||
const error = ref('')
|
||||
// loading 由父组件控制(回测/寻优时驱动),组件自身只暴露 loadBars
|
||||
|
||||
Reference in New Issue
Block a user