<template>
  <div v-if="content" v-html="content"></div>
  <div v-else class="fullwidth">
    <slot />
  </div>
</template>

<script lang="ts">
import Vue, { VNode } from 'vue';

export default Vue.extend({
  name: 'Div',
  data() {
    return {
      content: ''
    };
  },
  created() {
    if(this.$slots['default']) {
        let vnodes = this.$slots['default'] as VNode[]

        if(vnodes.length == 1) {
            let vnode = vnodes[0]

            if(vnode.text) {
                this.content = vnode.text
            }
        }
    }
  }
})
</script>