mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
feat(stock):优化股票迷你图刷新逻辑
- 在 Stock 组件中添加 lastPrice 属性,传递当前价格给 StockSparkLine 组件 - 在 StockSparkLine 组件中接收 lastPrice 属性,并使用它来更新 K 线图数据 - 优化 StockSparkLine 组件的渲染逻辑,使用 onMounted 和 watchEffect
This commit is contained in:
parent
3ba18e8ef2
commit
c180c2a5f8
@ -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">
|
||||
|
@ -125,7 +125,7 @@ onMounted(() => {
|
||||
|
||||
|
||||
watchEffect(() => {
|
||||
//console.log(stockName,'lastPrice变化为:', lastPrice)
|
||||
console.log(stockName,'lastPrice变化为:', lastPrice,lastPrice > openPrice)
|
||||
setChartData(chart.value);
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user