gaoluyang
6 天以前 adeb8b768926ed50a3fb0857f366d6a0308d2cc0
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
  <view class="footer-btns" v-if="show">
    <u-button 
      class="cancel-btn" 
      @click="handleCancel"
      :disabled="cancelDisabled"
    >
      {{ cancelText }}
    </u-button>
    <u-button 
      class="save-btn" 
      type="primary" 
      @click="handleConfirm"
      :disabled="confirmDisabled"
      :loading="loading"
    >
      {{ confirmText }}
    </u-button>
  </view>
</template>
 
<script setup>
import { defineProps, defineEmits } from 'vue'
 
// 定义 props
const props = defineProps({
  // 是否显示按钮组
  show: {
    type: Boolean,
    default: true
  },
  // 取消按钮文本
  cancelText: {
    type: String,
    default: '取消'
  },
  // 确认按钮文本
  confirmText: {
    type: String,
    default: '保存'
  },
  // 取消按钮是否禁用
  cancelDisabled: {
    type: Boolean,
    default: false
  },
  // 确认按钮是否禁用
  confirmDisabled: {
    type: Boolean,
    default: false
  },
  // 确认按钮是否显示加载状态
  loading: {
    type: Boolean,
    default: false
  }
})
 
// 定义事件
const emit = defineEmits(['cancel', 'confirm'])
 
// 处理取消事件
const handleCancel = () => {
  emit('cancel')
}
 
// 处理确认事件
const handleConfirm = () => {
  emit('confirm')
}
</script>
 
<style scoped lang="scss">
/* 底部按钮样式 */
.footer-btns {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.75rem 0;
  box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05);
  z-index: 1000;
}
 
.cancel-btn {
  font-weight: 400;
  font-size: 1rem;
  color: #FFFFFF;
  width: 6.375rem;
  background: #C7C9CC;
  box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
  border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
}
 
.save-btn {
  font-weight: 400;
  font-size: 1rem;
  color: #FFFFFF;
  width: 14rem;
  background: linear-gradient(140deg, #00BAFF 0%, #006CFB 100%);
  box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
  border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
}
</style>