<LineChart :reportsList="reportsList" v-if="Object.keys(reportsList).length" />
data() {
return {
reportsList: {},
};
},
created() {
reportsGet("reports/type/1").then((res) => {
console.log(res);
let { meta, data } = res.data;
if (meta.status == 200) {
this.reportsList = data;
} else {
this.$message.error(meta.msg);
}
});
},
data() {
return {
lineList: {},
};
},
props: {
reportsList: {
type: Object,
default: () => {
return {
title: {
text: "折线图",
},
tooltip: {},
xAxis: {
axisLabel: { interval: 0, rotate: 0, margin: 15 },
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
},
yAxis: {},
series: [
{
name: "销量",
type: "line",
data: [5, 20, 36, 10, 10, 20],
},
],
};
},
},
},
mounted() {
var myChart = echarts.init(this.$refs.main);