<script setup lang="ts">
import { Component } from 'vue'

// 使用defineProps而不赋值给变量
defineProps({
  label: {
    type: String,
    required: true
  },
  icon: {
    type: Object as () => Component,
    required: false
  }
})
</script>

<template>
  <div class="cell-item">
    <el-icon v-if="icon" :size="18" style="vertical-align: middle; margin-right: 4px;">
      <component :is="icon" />
    </el-icon>
    {{ label }}
  </div>
</template>

<style scoped lang="scss">
.cell-item {
  display: inline;
}

.cell-item::after {
  content: ':';
}
</style>
