index.vue 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <el-button v-bind="$props" v-if="isShow" @click="handleClick">
  3. <slot></slot>
  4. </el-button>
  5. </template>
  6. <script>
  7. import { mapGetters } from 'vuex'
  8. export default {
  9. props: {
  10. type: {
  11. type: String,
  12. default: 'default'
  13. },
  14. size: String,
  15. icon: {
  16. type: String,
  17. default: ''
  18. },
  19. nativeType: {
  20. type: String,
  21. default: 'button'
  22. },
  23. loading: Boolean,
  24. disabled: Boolean,
  25. plain: Boolean,
  26. autofocus: Boolean,
  27. round: Boolean,
  28. circle: Boolean,
  29. authorId: Number
  30. },
  31. computed: {
  32. ...mapGetters({
  33. getAuthIds: 'permission/getAuthIds'
  34. }),
  35. isShow() {
  36. if (this.authorId) {
  37. return this.getAuthIds.includes(this.authorId)
  38. } else {
  39. return false
  40. }
  41. }
  42. },
  43. methods: {
  44. handleClick(evt) {
  45. this.$emit('click', evt)
  46. }
  47. }
  48. }
  49. </script>