
父组件:
<lineChartIncome :opt="tradeIncome" />
import lineChartIncome from "./components/lineChartIncome";
data() {
return {
tradeIncome: {
seriesData: [[20, 14, 17,30,24], [12, 14, 15,40,50]],
xData: ['2019', '2020', '2021', '2022', '2023'],
legend: ['年营业收入', '完成收款额']
}
}
}
子组件:
<template>
<div style="width: 100%;height: 100%;">
<ChartPanel ref="chart" :option="options" :style="opt.yAxisName ? 'height:calc(100% - 16px)' : ''"></ChartPanel>
</div>
</template>
<script>
import * as echarts from 'echarts'
import ChartPanel from '@/components/ChartPanel';
export default {
components: {
ChartPanel
},
props: {
opt: {
type: Object,
default() {
return {
}
}
}
},