<template> <div class="chart-container"> <div class="chart-header"> <!--标题 --> <span class="title">供应商年度考核统计</span> </div> <div class="chart-content" :style="{ 'height': height, 'width': width }"> <!-- echarts内容 --> <MixChart :seriesData="seriesData" :xAxisData="xAxisData" :yAxisData="yAxisData" :legend="legend" /> </div> </div> </template> <script> import MixChart from "@/components/echart/barChart/MixChart.vue"; export default { name: "supplierAss", components: { MixChart, }, props: { name: { type: String, default: "", }, width: { type: String, default: "500px", }, height: { type: String, default: "300px", }, }, data() { return { xAxisData: [], yAxisData: [], seriesData: [], legend: [], }; }, mounted() { // this.fetchData(); setTimeout(() => { this.seriesData = [ { name: "a", type: "line", data: [13, 15, 19, 33], }, { name: "b", type: "line", data: [19, 17, 13, 23], }, { name: "c", type: "line", data: [33, 46, 39, 43], }, { name: "d", type: "line", data: [23, 55, 41, 37], }, ]; this.xAxisData = ["2019", "2020", "2021", "2022"]; this.yAxisData = [ { type: "value", show: true, axisLabel: { formatter: "{value}", fontSize: 12, color: "#000", }, axisLine: { show: false, }, splitLine: { //多条横线 show: true, }, interval: 20, }, ]; console.log(this.xAxisData, "this.xAxisData"); }, 2000); }, methods: { fetchData() {}, }, watch: { value(newVal) { this.fetchData(); }, }, }; </script> <style lang="scss" scoped> .chart-container { .chart-header { width: 500px; align-items: center; display: flex; justify-content: space-between; } } </style>