<template>
  <div class="dv-dropdown-menu"><slot></slot></div>
</template>

<script>
  import Emitter from 'canknow-ui-core/src/mixins/emitter';
  export default {
    name: 'DvDropdownMenu',
    mixins: [Emitter],
    props: {
      value: null
    },
    watch: {
      value (value) {
        this.broadcast('DvDropdownMenuItem', 'selectItem', value);
      }
    },
    mounted() {
      this.broadcast('DvDropdownMenuItem', 'selectItem', this.value);
      this.$on('select', (value) => {
        this.$emit('input', value);
        this.dispatch('DvTopToolbarItem', 'select', value);
      });
    }
  };
</script>
