<template>
  <label v-if="isSlots" :for="labelFor" :form="form">
    <slot></slot>
  </label>
  <label v-else :for="labelFor" :form="form" v-html="content"></label>
</template>

<script>
export default {
  name: "EdLabel",
  props: {
    for: {
      type: String,
      default: ""
    },
    form: {
      type: String,
      default: ""
    },
    content: {
      type: String,
      default: ""
    }
  },
  computed: {
    isSlots() {
      return Object.keys(this.$slots).length > 0 || Object.keys(this.$scopedSlots).length > 0
    },
    labelFor() {
      return this.for
    }
  }
}
</script>
