import { defineComponent, inject, computed, createVNode } from 'vue';
import { useTheme } from '../_theme/useTheme';
import { BREADCRUMB_KEY, itemCls } from './const';

var breadcrumbItem = defineComponent({
  name: 'FBreadcrumbItem',
  emits: ['click'],
  setup(props, _ref) {
    let {
      emit,
      slots
    } = _ref;
    useTheme();
    const {
      props: parentProps
    } = inject(BREADCRUMB_KEY);
    const itemStyle = computed(() => {
      return {
        fontSize: `${parentProps.fontSize}px`,
        lineHeight: 1
      };
    });

    // 处理点击跳转的事件
    const handleClick = () => {
      // 触发用户自定义的click事件
      emit('click');
    };
    return () => {
      var _slots$default;
      return createVNode("div", {
        "class": itemCls,
        "style": itemStyle.value,
        "onClick": () => handleClick()
      }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots), createVNode("div", {
        "class": `${itemCls}-separator`
      }, [parentProps.separator])]);
    };
  }
});

export { breadcrumbItem as default };
