<template>
  <div class="empty">
    <img :src="curImg" alt="">
    <span>暂无数据</span>
  </div>
</template>

<script>
import { themeChangeMixin } from '@/mixins/themeChangeMixin'
export default {
  name: 'Empty',
  mixins: [themeChangeMixin],
  props: {
    type: {
      type: String,
      default: 'noData'
    }
  },
  data() {
    return {
      typeMap: {
        black: {
          noData: require('../../assets/empty-image/black/no-data.png')
        },
        default: {
          noData: require('../../assets/empty-image/default/no-data.png')
        }
      },
      curImg: ''
    }
  },
  watch: {
    theme: {
      handler(val) {
        this.curImg = this.typeMap[val]?.[this.type]
      },
      // immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>
.empty {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;

  img {
    width: 100px;
    height: 100px;
  }

  span {
    color: var(--color-70);
    margin-top: 8px;
    font-size: 12px;
  }
}
</style>