import "./index.css";
/* script */
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
import { componentMixin, createComponentName } from '../_utils/component';
import Icon from '../Icon';
const __vue_script__ = {
  name: createComponentName('button'),
  components: {
    Icon
  },
  mixins: [componentMixin],
  props: {
    // 按钮大小
    size: {
      // "small"/"normal"/"large"
      type: String,
      default: 'normal'
    },
    // 按钮类型
    type: {
      // "dange"/ "normal" /"primary" /"text"
      type: String,
      default: 'normal'
    },
    // 跳转链接
    href: {
      type: String,
      default: ''
    },
    // TODO: loading状态 需要补充
    loading: {
      type: Boolean,
      default: false
    },
    // 禁用状态
    disabled: {
      type: Boolean,
      default: false
    },
    // 是否带圆角
    round: {
      type: Boolean,
      default: false
    },
    icon: {
      type: String,
      default: ''
    },
    // 原生type类型
    nativeType: {
      // "button" / "submit" / "reset"
      type: String
    }
  },

  data() {
    return {
      active: false
    };
  },

  computed: {
    className() {
      return this.bem({
        [this.size]: this.size !== 'normal',
        [this.type || 'normal']: true,
        active: this.active,
        disabled: this.disabled,
        round: this.round,
        loading: this.loading,
        'icon-only': this.icon && !this.$slots.default
      });
    }

  },
  methods: {
    click(e) {
      clearTimeout(this.timeout);
      this.active = true;
      this.timeout = window.setTimeout(() => {
        this.active = false;
      }, 200); // 点击事件
      // @arg MouseEvent

      this.$emit('click', e);
    }

  }
};
/* template */

var __vue_render__ = function () {
  var _vm = this;

  var _h = _vm.$createElement;

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

  return _vm.href ? _c("a", {
    class: _vm.className,
    attrs: {
      href: _vm.href
    }
  }, [_vm.icon ? _c("Icon", {
    attrs: {
      name: _vm.icon
    }
  }) : _vm._e(), _vm._v(" "), _c("span"), _vm._v(" "), _vm._t("default")], 2) : _c("button", {
    class: _vm.className,
    attrs: {
      disabled: _vm.disabled,
      type: _vm.nativeType
    },
    on: {
      click: _vm.click
    }
  }, [_vm.loading ? _c("Icon", {
    attrs: {
      name: "loading"
    }
  }) : _vm.icon ? _c("Icon", {
    attrs: {
      name: _vm.icon
    }
  }) : _vm._e(), _vm._v(" "), _vm.$slots.default ? _c("span", {
    class: _vm.bem("content")
  }, [_vm._t("default")], 2) : _vm._e()], 1);
};

var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */

const __vue_inject_styles__ = undefined;
/* scoped */

const __vue_scope_id__ = undefined;
/* module identifier */

const __vue_module_identifier__ = undefined;
/* functional template */

const __vue_is_functional_template__ = false;
/* component normalizer */

import __vue_normalize__ from '../_utils/vue-normalize-component.js';
/* style inject */

/* style inject SSR */

export default __vue_normalize__({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);