From 408b743b5ef9affaea95b48d5bea40080dbca34e Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Sat, 20 Sep 2025 20:36:41 +0800
Subject: [PATCH] 修改ws
---
src/page/kline/components/kLine.vue | 50 +++++++++++++++++++++++++++++---------------------
1 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/src/page/kline/components/kLine.vue b/src/page/kline/components/kLine.vue
index 4367ccf..4a4ead1 100644
--- a/src/page/kline/components/kLine.vue
+++ b/src/page/kline/components/kLine.vue
@@ -954,7 +954,7 @@
],
SplashTitle: "loading...",
Symbol: "600015.sh",
- IsAutoUpdate: true, // 是自动更新数据
+ IsAutoUpdate: false, // 是自动更新数据
AutoUpdateFrequency: 15000,
IsApiPeriod: true,
IsShowRightMenu: false, // 是否显示右键菜单
@@ -1071,14 +1071,14 @@
Name: i18n.t("hj89"),
ID: 2
},
- {
- Name: i18n.t("hj90"),
- ID: 4
- },
- {
- Name: i18n.t("hj91"),
- ID: 5
- },
+ // {
+ // Name: i18n.t("hj90"),
+ // ID: 4
+ // },
+ // {
+ // Name: i18n.t("hj91"),
+ // ID: 5
+ // },
{
Name: i18n.t("hj92"),
ID: 7
@@ -1169,12 +1169,9 @@
// this.CreateKLineChart();
this.$nextTick(() => {
- // this.timerss = setInterval(() => {
- this.CreateMinuteChart();
- this.CreateKLineChart();
- // }, 3000);
// this.CreateMinuteChart();
- // this.CreateKLineChart();
+ this.CreateKLineChart();
+
// this.timerss = setInterval(() => {
// // this.KLineChart = null
// // this.CreateMinuteChart();
@@ -1221,8 +1218,19 @@
beforeDestroy() {
clearInterval(this.timerss); // 在组件销毁前清除定时器
this.timerss = null;
+ this.clearTime();
},
methods: {
+ // 清除所有定时器
+ clearTime() {
+ // 创建一个额外的定时器以获取当前最大定时器 ID
+ let lastIntervalId = setInterval(() => {}, 1000);
+ // 遍历并清除所有定时器
+ for (let i = 1; i <= lastIntervalId; i++) {
+ clearInterval(i);
+ clearTimeout(i);
+ }
+ },
OnSize() {
var width = this.$refs.right.clientWidth;
// var rightTab = this.$refs.rightTab
@@ -1276,7 +1284,7 @@
chart.SetOption(option);
this.Chart = chart;
},
-
+ // k线图创建
CreateKLineChart() {
if (this.KLineChart) return;
@@ -1284,6 +1292,7 @@
option.Symbol = this.Symbol;
option.NetworkFilter = (data, callback) => {
+ // console.log("data, callback", data, callback);
this.NetworkFilter(data, callback);
}; // 网络请求回调函数
var chart = HQChart.Chart.JSChart.Init(this.$refs.kline2);
@@ -1326,7 +1335,7 @@
item,
type // K线周期
) {
- console.log("1");
+ this.clearTime();
//分时额外处理才注释的
this.chartType = type;
this.KLinePeriodIndex = index;
@@ -1360,10 +1369,7 @@
callback // 第3方数据替换接口
) {
EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data);
- if (this.timerss) {
- clearInterval(this.timerss);
- this.timerss = null;
- }
+
this.getFilter(data, callback);
this.timerss = setInterval(() => {
this.getFilter(data, callback);
@@ -1413,7 +1419,9 @@
</script>
<style lang="less">
@animation-duration: 0.3s;
-
+.parameter{
+ background-color: #333 !important;
+}
.box {
width: 100%;
height: 100%;
--
Gitblit v1.9.3