index.vue 662 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <el-empty
  3. v-if="isSeriesEmpty"
  4. description="暂无数据"
  5. class="custom-image"
  6. style="text-align:center;"
  7. />
  8. <chart-bar v-else v-bind="$props" />
  9. </template>
  10. <script>
  11. import { isEmpty } from "lodash";
  12. import ChartBar from "./echart_bar.vue";
  13. export default {
  14. name: "EchartBar",
  15. components: { ChartBar },
  16. props: ChartBar.props,
  17. computed: {
  18. // 针对饼图数据是不是无效的判断
  19. isSeriesEmpty() {
  20. return (
  21. isEmpty(this.seriesData) || this.seriesData.every((item) => !item.data)
  22. );
  23. },
  24. },
  25. };
  26. </script>
  27. <style>
  28. .custom-image .van-empty__image img{
  29. height: 200px;
  30. }
  31. </style>