index.vue 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <div
  3. class="head-btn"
  4. :class="{
  5. 'head-btn-disabled': disabled
  6. }"
  7. @click="$emit('click')"
  8. >
  9. <slot />
  10. <i
  11. v-if="loading"
  12. class="el-icon el-icon-loading"
  13. style="padding-left: 4px;"
  14. />
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. loading: {
  21. type: Boolean,
  22. default: false
  23. },
  24. disabled: {
  25. type: Boolean,
  26. default: false
  27. }
  28. },
  29. methods: {
  30. click (e) {
  31. e.preventDefault()
  32. if (!this.loading) {
  33. this.$emit('click')
  34. }
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .head-btn {
  41. display: flex;
  42. background-color: #303640;
  43. cursor: pointer;
  44. width: auto;
  45. justify-content: center;
  46. align-items: center;
  47. margin-right: 4px;
  48. padding: 4px 10px;
  49. font-size: 12px;
  50. &:hover {
  51. background-color: #414750;
  52. }
  53. &-disabled {
  54. cursor: not-allowed;
  55. background-color: #303640;
  56. color: #999;
  57. &:hover {
  58. background-color: #303640;
  59. }
  60. }
  61. }
  62. </style>