import _extends from "@babel/runtime/helpers/esm/extends";
import create from "../utils/create";
import { ChildrenMixin } from "../mixins/relation";
import Info from "../info";
import { route, routeProps } from "../utils/router";
export default create({
  render: function render() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('a', {
      class: _vm.b({
        select: this.select,
        disabled: this.disabled
      }),
      on: {
        "click": _vm.onClick
      }
    }, [_c('div', {
      class: _vm.b('text')
    }, [_vm._t("title", [_vm._v("\n      " + _vm._s(_vm.title) + "\n    ")]), _c('Info', {
      class: _vm.b('info'),
      attrs: {
        "dot": _vm.dot,
        "info": _vm.badge
      }
    })], 2)]);
  },
  components: {
    Info: Info
  },
  name: "sidebar-item",
  mixins: [ChildrenMixin("vmSidebar")],
  props: _extends({}, routeProps, {
    dot: Boolean,
    badge: [Number, String],
    title: String,
    disabled: Boolean
  }),
  computed: {
    select: function select() {
      return this.index === +this.parents.activeKey;
    }
  },
  methods: {
    onClick: function onClick() {
      if (this.disabled) {
        return;
      }

      this.$emit("click", this.index);
      this.parents.$emit("input", this.index);
      this.parents.setIndex(this.index);
      route(this.$router, this);
    }
  }
});