diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index effd541..7918c12 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -2757,22 +2757,23 @@ async function renderChartsSequentially(clonedData, stockIndex = 0) { console.log(`${config.name}Ref方法:`, typeof config.ref[config.method]); if (typeof config.ref[config.method] === "function") { - try { - // 等待DOM元素完全渲染 - await new Promise((resolve) => setTimeout(resolve, 100)); - - config.ref[config.method](...config.params); - console.log(`第${stockIndex}个股票的${config.name}图表渲染成功`); - - // 每个图表渲染完成后等待一段时间再渲染下一个 - await new Promise((resolve) => setTimeout(resolve, 800)); - } catch (error) { - console.error( - `第${stockIndex}个股票的${config.name}图表渲染失败:`, - error - ); - } - } else { + try { + // 增加延迟时间,特别是对于第2个及后续股票 + const delay = stockIndex === 0 ? 100 : 300 + (stockIndex * 100); + await new Promise((resolve) => setTimeout(resolve, delay)); + + config.ref[config.method](...config.params); + console.log(`第${stockIndex}个股票的${config.name}图表渲染成功`); + + // 每个图表渲染完成后等待一段时间再渲染下一个 + await new Promise((resolve) => setTimeout(resolve, 800)); + } catch (error) { + console.error( + `第${stockIndex}个股票的${config.name}图表渲染失败:`, + error + ); + } + } else { console.error( `第${stockIndex}个股票的${config.name}Ref.${config.method} 方法不存在` ); diff --git a/src/views/components/emotionDecod.vue b/src/views/components/emotionDecod.vue index a911575..76a1bf6 100644 --- a/src/views/components/emotionDecod.vue +++ b/src/views/components/emotionDecod.vue @@ -406,6 +406,12 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { ], }; + // 添加DOM元素检查 + if (!KlineCanvs.value) { + console.error('DOM元素未准备好,无法初始化ECharts'); + return; + } + // 创造echarts图 if (KlineCanvsChart) { KlineCanvsChart.dispose();