|
|
@ -5,6 +5,7 @@ |
|
|
|
<script setup> |
|
|
|
import { ref, onMounted, onBeforeUnmount, toRef, reactive } from 'vue' |
|
|
|
import { useLanguage } from '@/utils/languageService' |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
import * as echarts from 'echarts' |
|
|
|
// import { text } from 'stream/consumers' |
|
|
|
// import { start } from 'repl' |
|
|
@ -147,23 +148,23 @@ const generateGraphics = (min, max) => { |
|
|
|
const klineData = ref() |
|
|
|
const qxnlzhqData = ref() |
|
|
|
|
|
|
|
const fetchData = async () => { |
|
|
|
const qxnlzhqStore = localStorage.getItem('qxnlzhq') |
|
|
|
const klineStore = localStorage.getItem('kline20Data') |
|
|
|
|
|
|
|
// 检查是否有缓存数据 |
|
|
|
if (qxnlzhqStore && klineStore) { |
|
|
|
const qxnlzhqParsed = JSON.parse(qxnlzhqStore) |
|
|
|
const klineParsed = JSON.parse(klineStore) |
|
|
|
|
|
|
|
// 深拷贝数据 |
|
|
|
qxnlzhqData.value = JSON.parse(JSON.stringify(qxnlzhqParsed)) |
|
|
|
klineData.value = JSON.parse(JSON.stringify(klineParsed)) |
|
|
|
initQXNLZHEcharts(klineData.value, qxnlzhqData.value) |
|
|
|
} else { |
|
|
|
ElMessage.error(response.data.msg || '请求失败') |
|
|
|
} |
|
|
|
} |
|
|
|
// const fetchData = async () => { |
|
|
|
// const qxnlzhqStore = localStorage.getItem('qxnlzhq') |
|
|
|
// const klineStore = localStorage.getItem('kline20Data') |
|
|
|
|
|
|
|
// // 检查是否有缓存数据 |
|
|
|
// if (qxnlzhqStore && klineStore) { |
|
|
|
// const qxnlzhqParsed = JSON.parse(qxnlzhqStore) |
|
|
|
// const klineParsed = JSON.parse(klineStore) |
|
|
|
|
|
|
|
// // 深拷贝数据 |
|
|
|
// qxnlzhqData.value = JSON.parse(JSON.stringify(qxnlzhqParsed)) |
|
|
|
// klineData.value = JSON.parse(JSON.stringify(klineParsed)) |
|
|
|
// initQXNLZHEcharts(klineData.value, qxnlzhqData.value) |
|
|
|
// } else { |
|
|
|
// ElMessage.error(response.data.msg || '请求失败') |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
function initQXNLZHEcharts(kline, qxnlzhqData) { |
|
|
|
// console.log('kline', kline) |
|
|
@ -1395,15 +1396,15 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { |
|
|
|
} |
|
|
|
|
|
|
|
// 监听数据变化或语言变化 |
|
|
|
watch( |
|
|
|
() => t.value, |
|
|
|
(newLang) => { |
|
|
|
fetchData() |
|
|
|
}, |
|
|
|
{ immediate: true, deep: true } |
|
|
|
) |
|
|
|
|
|
|
|
onMounted(fetchData) |
|
|
|
// watch( |
|
|
|
// () => t.value, |
|
|
|
// (newLang) => { |
|
|
|
// fetchData() |
|
|
|
// }, |
|
|
|
// { immediate: true, deep: true } |
|
|
|
// ) |
|
|
|
|
|
|
|
// onMounted(fetchData) |
|
|
|
|
|
|
|
onBeforeUnmount(() => { |
|
|
|
// 组件卸载时销毁图表 |
|
|
|