<template>
  <li
    class="ai-dropdown-menu__item"
    :class="{
      'is-disabled': disabled,
      'ai-dropdown-menu__item--divided': divided
    }"
    @click="handleClick"
    :aria-disabled="disabled"
    :tabindex="disabled ? null : -1"
  >
    <i :class="icon" v-if="icon"></i>
    <slot></slot>
  </li>
</template>
<script>
  import Emitter from 'ai-vue/src/mixins/emitter';

  export default {
    name: 'AiDropdownItem',

    mixins: [Emitter],

    props: {
      command: {},
      disabled: Boolean,
      divided: Boolean,
      icon: String
    },

    methods: {
      handleClick(e) {
        this.dispatch('AiDropdown', 'menu-item-click', [this.command, this]);
      }
    }
  };
</script>
