<template>
  <el-button :size="size" v-bind="$attrs" @click="btnClick">
    <slot></slot>
  </el-button>
</template>

<script>
import $ from 'jquery'

export default {
  name: "CmsButton",
  data() {
    let { ...listeners } = this.$listeners;
    return {
      listeners: listeners,
    };
  },
  methods: {
    btnClick($event) {
      if ($event) $event.preventDefault();
      if ($($event.currentTarget).hasClass("is-disabled")) {
        return false;
      }
      this.$emit("click");
    },
  },
  computed: {
    buttonSize() {
      return this.$store.getters["setting/getButtonSize"];
    },
  },
  props: {
    size: {
      type: String,
      default: "small"
    }
  }
};
</script>
