fix(portfolio-backtest): 净值曲线watch加flush:'post'
watch(equityCurve) 默认 flush:'pre' 在 DOM 更新前触发, equityEl div(在 v-if=result 内)尚未挂载→echarts.init 拿不到 DOM→空图。 flush:'post' 让 watch 在 DOM 更新后触发,曲线正常渲染。
This commit is contained in:
@@ -65,7 +65,7 @@ function renderEquity(): void {
|
||||
onMounted(() => {
|
||||
// 等 dom 挂载后渲染(若有初始数据)
|
||||
})
|
||||
watch(equityCurve, renderEquity, { deep: true })
|
||||
watch(equityCurve, renderEquity, { deep: true, flush: 'post' })
|
||||
|
||||
function fmtPct(v: number | null | undefined): string {
|
||||
if (v === null || v === undefined || !Number.isFinite(v)) return '-'
|
||||
|
||||
Reference in New Issue
Block a user