Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
104f9290
Commit
104f9290
authored
Feb 05, 2026
by
水玉婷
Browse files
feat:修复图表渲染bug
parent
06e56074
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/views/components/ChartComponent.vue
View file @
104f9290
...
...
@@ -62,6 +62,7 @@
:mode="selectedChartType === CHART_TYPES.PIE ? undefined : 'multiple'"
:maxTagCount="2"
:maxTagTextLength="6"
:showSearch="false"
:dropdownMatchSelectWidth="false"
:getPopupContainer="triggerNode => triggerNode.parentNode"
placeholder="请选择指标"
...
...
src/views/components/ColumnChart.vue
View file @
104f9290
...
...
@@ -6,7 +6,7 @@
<
div class="empty-text">暂无数据
</div>
<
div class="empty-desc">当前查询条件下没有找到相关数据
</div>
</div>
<
div v-else
:key="chartDataKey"
ref="chartContainer" class="chart-container">
</div>
<
div v-else ref="chartContainer" class="chart-container">
</div>
<
div v-if="error" class="chart-error">
{{
error
}}
</div>
</div>
</
template
>
...
...
@@ -35,8 +35,6 @@ const chartContainer = ref<HTMLElement>();
const
chartInstance
=
shallowRef
<
echarts
.
ECharts
|
null
>
(
null
);
const
error
=
ref
<
string
>
(
''
);
const
isEmpty
=
ref
<
boolean
>
(
false
);
// 用于强制重新渲染图表容器的key
const
chartDataKey
=
ref
<
number
>
(
0
);
// ========== 工具函数抽离 ==========
...
...
@@ -737,8 +735,6 @@ const createChart = async () => {
// 监听数据变化
watch
(()
=>
props
.
chartData
,
async
()
=>
{
// 更新key来强制重新渲染图表容器
chartDataKey
.
value
++
;
await
createChart
();
});
...
...
src/views/components/LineChart.vue
View file @
104f9290
...
...
@@ -6,7 +6,7 @@
<
div class="empty-text">暂无数据
</div>
<
div class="empty-desc">当前查询条件下没有找到相关数据
</div>
</div>
<
div v-else
:key="chartDataKey"
ref="chartContainer" class="chart-container">
</div>
<
div v-else ref="chartContainer" class="chart-container">
</div>
<
div v-if="error" class="chart-error">
{{
error
}}
</div>
</div>
</
template
>
...
...
@@ -35,8 +35,6 @@ const chartContainer = ref<HTMLElement>();
const
chartInstance
=
shallowRef
<
echarts
.
ECharts
|
null
>
(
null
);
const
error
=
ref
<
string
>
(
''
);
const
isEmpty
=
ref
<
boolean
>
(
false
);
// 用于强制重新渲染图表容器的key
const
chartDataKey
=
ref
<
number
>
(
0
);
// ========== 工具函数抽离 ==========
...
...
@@ -738,8 +736,6 @@ const createChart = async () => {
// 监听数据变化
watch
(()
=>
props
.
chartData
,
async
()
=>
{
// 更新key来强制重新渲染图表容器
chartDataKey
.
value
++
;
await
createChart
();
});
...
...
src/views/components/PieChart.vue
View file @
104f9290
...
...
@@ -6,7 +6,7 @@
<
div class="empty-text">暂无数据
</div>
<
div class="empty-desc">当前查询条件下没有找到相关数据
</div>
</div>
<
div v-else
:key="chartDataKey"
ref="chartContainer" class="chart-container">
</div>
<
div v-else ref="chartContainer" class="chart-container">
</div>
<
div v-if="error" class="chart-error">
{{
error
}}
</div>
</div>
</
template
>
...
...
@@ -35,8 +35,6 @@ const chartContainer = ref<HTMLElement>();
const
chartInstance
=
shallowRef
<
echarts
.
ECharts
|
null
>
(
null
);
const
error
=
ref
<
string
>
(
''
);
const
isEmpty
=
ref
<
boolean
>
(
false
);
// 用于强制重新渲染图表容器的key
const
chartDataKey
=
ref
<
number
>
(
0
);
// ========== 工具函数抽离 ==========
...
...
@@ -404,8 +402,6 @@ const createChart = async () => {
// 监听数据变化
watch
(()
=>
props
.
chartData
,
async
()
=>
{
// 更新key来强制重新渲染图表容器
chartDataKey
.
value
++
;
await
createChart
();
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment