feat(stock):优化股票迷你图刷新逻辑

- 在 Stock 组件中添加 lastPrice 属性,传递当前价格给 StockSparkLine 组件
- 在 StockSparkLine 组件中接收 lastPrice 属性,并使用它来更新 K 线图数据
- 优化 StockSparkLine 组件的渲染逻辑,使用 onMounted 和 watchEffect
This commit is contained in:
ArvinLovegood 2025-07-08 10:58:01 +08:00
parent 3ba18e8ef2
commit c180c2a5f8
2 changed files with 2 additions and 2 deletions

View File

@ -1815,7 +1815,7 @@ function searchStockReport(stockCode) {
</n-text>
</n-gi>
<n-gi :span="6">
<stock-spark-line :last-price="result['当前价格']" :open-price="result['昨日收盘价']" :stock-code="result['股票代码']" :stock-name="result['股票名称']" ></stock-spark-line>
<stock-spark-line :last-price="Number(result['当前价格'])" :open-price="Number(result['昨日收盘价'])" :stock-code="result['股票代码']" :stock-name="result['股票名称']" ></stock-spark-line>
</n-gi>
</n-grid>
<n-grid :cols="2" :y-gap="4" :x-gap="4">

View File

@ -125,7 +125,7 @@ onMounted(() => {
watchEffect(() => {
//console.log(stockName,'lastPrice:', lastPrice)
console.log(stockName,'lastPrice变化为:', lastPrice,lastPrice > openPrice)
setChartData(chart.value);
})