li.shaoyi 3 سال پیش
والد
کامیت
7654b8b53d
1فایلهای تغییر یافته به همراه10 افزوده شده و 10 حذف شده
  1. 10 10
      src/common/components/echart/echart-kline/index.vue

+ 10 - 10
src/common/components/echart/echart-kline/index.vue

@@ -220,7 +220,7 @@ export default defineComponent({
         lastIndex = source.length - 1, // 历史行情最后索引位置
         lastTime = moment(source[lastIndex].date), // 历史行情最后时间
         newTime = moment(props.quoteData.lasttime), // 实时行情最新时间
-        newPrice = props.quoteData.last; // 实时行情最新价
+        { last, opened, highest, lowest } = props.quoteData; // 实时行情
 
       let cycleMilliseconds = 60 * 1000; // 周期毫秒数
 
@@ -256,10 +256,10 @@ export default defineComponent({
           // 添加历史行情
           source.push({
             date: lastTime.format('YYYY-MM-DD HH:mm:ss'),
-            open: newPrice,
-            close: newPrice,
-            lowest: newPrice,
-            highest: newPrice,
+            open: opened,
+            close: last,
+            lowest: lowest,
+            highest: highest,
             ma5: '-',
             ma10: '-',
             ma15: '-',
@@ -275,13 +275,13 @@ export default defineComponent({
           historyIndexs.push(lastIndex + 1); // 添加历史行情索引
         } else {
           const lastData = source[lastIndex];
-          if (lastData.lowest > newPrice) {
-            lastData.lowest = newPrice; //更新最低价
+          if (lastData.lowest > last) {
+            lastData.lowest = last; //更新最低价
           }
-          if (lastData.highest < newPrice) {
-            lastData.highest = newPrice; //更新最高价
+          if (lastData.highest < last) {
+            lastData.highest = last; //更新最高价
           }
-          lastData.close = newPrice; //更新收盘价
+          lastData.close = last; //更新收盘价
         }
 
         calcMA('ma5', 5);