<template>
  <el-empty
    v-if="isSeriesEmpty"
    description="暂无数据"
    class="custom-image"
    style="text-align:center;"
  />
  <chart-bar v-else v-bind="$props" />
</template>

<script>
import { isEmpty } from "lodash";
import ChartBar from "./echart_bar.vue";

export default {
  name: "EchartBar",
  components: { ChartBar },
  props: ChartBar.props,
  computed: {
    // 针对饼图数据是不是无效的判断
    isSeriesEmpty() {
      return (
        isEmpty(this.seriesData) || this.seriesData.every((item) => !item.data)
      );
    },
  },
};
</script>
<style>
  .custom-image .van-empty__image img{
    height: 200px;
  }
</style>
