This commit is contained in:
‘937886381’
2025-11-24 14:10:46 +08:00
parent dfa4ff3f54
commit 694beb5851
54 changed files with 1612 additions and 2290 deletions

View File

@@ -11,10 +11,34 @@ export default {
return {};
},
props: {
yName: {
type: String,
default: () => '元/㎡'
seriesData: {
type: Array,
default: () => []
},
xData: {
type: Array,
default: () => []
},
name: {
type: String,
default: () => { }
},
},
watch: {
// 监听 xData 变化,触发图表更新
xData: {
handler() {
this.$nextTick(() => this.initData());
},
deep: true // 深度监听数组内元素变化
},
// 监听 seriesData 变化,触发图表更新
seriesData: {
handler() {
this.$nextTick(() => this.initData());
},
deep: true // 深度监听数组内元素变化
}
},
mounted() {
this.$nextTick(() => {
@@ -69,7 +93,7 @@ export default {
interval: 0,
padding: [5, 0, 0, 0] // 标签向下偏移,避免与柱子底部重叠
},
data: ['6月', '7月', '8月', '9月', '10月', '11月']
data: this.xData
}
],
yAxis: [
@@ -98,7 +122,7 @@ export default {
],
series: [
{
name: '利润',
name: this.name,
type: 'line',
// yAxisIndex: 1,
lineStyle: {
@@ -118,7 +142,7 @@ export default {
{ offset: 1, color: 'rgba(40, 138, 255, 0)' }
])
},
data: [200, 280, 180, 300, 220, 350],
data: this.seriesData,
symbol: 'circle',
symbolSize: 6
},