如果你使用的是 Vue,我希望你使用的是 vue-echarts 组件。
因此,在组件中,您将在 props 中传递选项。您可以在此选项中设置“高度”属性。
像这样:
<template>
<div>
<ECharts :options="options" />
</div>
</template>
<script>
import ECharts from 'vue-echarts';
import 'echarts/lib/chart/bar';
import 'echarts/lib/component/tooltip';
import 'echarts/lib/component/legend';
export default {
name: 'ChartTest',
components: {
ECharts,
},
data() {
return {
options: {
height: '120px',
legend: {
show: true
},
xAxis: [
{
type: 'category',
data: ['a', 'b', 'c'],
},
],
yAxis: [{ type: 'value' }],
series: [
{ name: 'test', type: 'bar', data: [1, 2, 3] },
],
},
};
},
};
</script>