<template>
  <div class="title">
    <n-image :width="w" :height="h" :src="option.dataset.url" preview-disabled />
    <span class="Tupian">
      <Tupian :w="w" :h="h" />
    </span>
  </div>
</template>

<script setup lang="ts">
  import { computed, PropType, toRefs, watch, reactive, ref } from 'vue';
  import { CreateComponentType } from '@/packages/index.d';
  import { icon } from '@/plugins';
  import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
  import { useChartDataFetch } from '@/hooks';
  import Tupian from './svg/tupian.vue';

  const props = defineProps({
    chartConfig: {
      type: Object as PropType<CreateComponentType>,
      required: true,
    },
  });

  const { w, h } = toRefs(props.chartConfig.attr);

  const option = reactive({
    dataset: props.chartConfig.option.dataset,
  });
</script>

<style lang="scss" scoped>
  .title {
    width: v-bind('`${w}px`');
    height: v-bind('`${h}px`');
  }
  .Tupian {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 1;
  }
</style>
