<template>
  <div class="comp-content">
    <div v-if="data">
      <slot name="default">
        {{ data }}
      </slot>
    </div>
    <div v-else-if="editMode" class="tip">
      <el-icon :size="14">
        <Edit />
      </el-icon>
      <span class="text">双击编辑</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Edit } from '@element-plus/icons-vue';

interface Props {
  data: any;
  editMode?: boolean;
}

withDefaults(defineProps<Props>(), {
  data: null,
  editMode: false,
});
</script>

<style lang="scss" scoped>
.comp-content {
  .tip {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 12px;
    color: var(--el-text-color-secondary);
    .text {
      padding-left: 2px;
    }
  }
}
</style>
