<template>
  <el-button v-bind="$props" v-if="isShow" @click="handleClick">
    <slot></slot>
  </el-button>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  props: {
    type: {
      type: String,
      default: 'default'
    },
    size: String,
    icon: {
      type: String,
      default: ''
    },
    nativeType: {
      type: String,
      default: 'button'
    },
    loading: Boolean,
    disabled: Boolean,
    plain: Boolean,
    autofocus: Boolean,
    round: Boolean,
    circle: Boolean,
    authorId: Number
  },
  computed: {
    ...mapGetters({
      getAuthIds: 'permission/getAuthIds'
    }),
    isShow() {
      if (this.authorId) {
        return this.getAuthIds.includes(this.authorId)
      } else {
        return false
      }
    }
  },
  methods: {
    handleClick(evt) {
      this.$emit('click', evt)
    }
  }
}
</script>
