<template>
  <view :class="menuItemClass" @click="onClick">
    <view
      v-if="icon || (withIcon && direction === 'vertical')"
      :class="bem.e('icon')"
    >
      <sar-icon v-if="icon" :name="icon" :family="iconFamily" />
    </view>
    <view :class="bem.e('text')">
      {{ text }}
    </view>
  </view>
</template>

<script lang="ts">
import { defineComponent as _defineComponent } from "vue";
import { computed } from "vue";
import { classNames, createBem } from "../utils";
import SarIcon from "../icon/icon.vue";
import { menuItemProps } from "../menu/common";
const __default__ = {
  options: {
    virtualHost: true,
    styleIsolation: "shared"
  }
};
export default /* @__PURE__ */ _defineComponent({
  ...__default__,
  __name: "menu-item",
  props: menuItemProps,
  emits: ["click"],
  setup(__props, { expose: __expose, emit: __emit }) {
    __expose();
    const props = __props;
    const emit = __emit;
    const bem = createBem("menu");
    const onClick = (event) => {
      emit("click", event);
    };
    const menuItemClass = computed(() => {
      return classNames(bem.e("item"), bem.em("item", "disabled", props.disabled));
    });
    const __returned__ = { props, emit, bem, onClick, menuItemClass, SarIcon };
    return __returned__;
  }
});
</script>

<style lang="scss">
@use './index.scss';
</style>