songshankun
2023-11-09 347ca79555b4afdf8d5687bd79ccb04e14cb03e2
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
<template>
  <button class="big-button user-style" :class="{ disabled: props.disabled }" :disabled="props.disabled">
    <slot></slot>
  </button>
</template>
<script setup lang="ts">
import { toRefs } from 'vue'
 
const props = withDefaults(
  defineProps<{
    bgColor?: string
    color?: string
    disabled?: boolean
  }>(),
  {
    bgColor: '#4efefa',
    color: '#fff',
    disabled: false
  }
)
 
const { bgColor, color } = toRefs(props)
</script>
<style scoped lang="scss">
.big-button {
  min-width: 100px;
  background-color: #4efefa;
  color: #fff;
  height: 50px;
  text-align: center;
  line-height: 50px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  outline: none;
  margin: 0;
  padding: 0 26px;
  border: none;
}
.user-style {
  color: v-bind(color);
  background-color: v-bind(bgColor);
}
.big-button.disabled {
  cursor: not-allowed;
  background-color: #afafaf;
  color: #868686;
}
</style>