mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
fix(stock):修正开盘价数据源并优化迷你分时图渲染逻辑
- 将 stock.vue 中的开盘价数据源从"今日开盘价"改为"昨日收盘价" - 在 stockSparkLine.vue 中修改图表初始化方式,使用 document.getElementById 获取图表容器 -为 stockSparkLine.vue 中的图表容器添加唯一的 id 属性,以确保正确渲染多个图表
This commit is contained in:
parent
6440885688
commit
f0314187e5
@ -1815,7 +1815,7 @@ function searchStockReport(stockCode) {
|
|||||||
</n-text>
|
</n-text>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
<n-gi :span="6">
|
<n-gi :span="6">
|
||||||
<stock-spark-line :open-price="result['今日开盘价']" :stock-code="result['股票代码']" :stock-name="result['股票名称']" ></stock-spark-line>
|
<stock-spark-line :open-price="result['昨日收盘价']" :stock-code="result['股票代码']" :stock-name="result['股票名称']" ></stock-spark-line>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
<n-grid :cols="2" :y-gap="4" :x-gap="4">
|
<n-grid :cols="2" :y-gap="4" :x-gap="4">
|
||||||
|
@ -114,7 +114,8 @@ function setChartData(chart) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const chart = echarts.init(chartRef.value);
|
|
||||||
|
const chart = echarts.init( document.getElementById('sparkLine'+stockCode));
|
||||||
setChartData(chart);
|
setChartData(chart);
|
||||||
|
|
||||||
// setInterval(() => {
|
// setInterval(() => {
|
||||||
@ -123,6 +124,6 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div style="height: 20px;width: 100%" ref="chartRef">
|
<div style="height: 20px;width: 100%" :id="'sparkLine'+stockCode">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
Loading…
x
Reference in New Issue
Block a user