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