bottom-bar.vue
1.9 KB
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
<template>
<view class="bottom-wrap">
<view class="bottomBar">
<view class="barBox">
<!-- 自定义底部按钮 -->
<slot>
<!-- 默认显示 -->
<view class="cancel" v-if="!isLastRecord" @click="leftClick">{{leftBtnText}}</view>
<view class="save" @click="rightClick">{{rightBtnText}}</view>
</slot>
</view>
</view>
</view>
</template>
<script setup>
const emits = defineEmits(['leftClick', 'rightClick'])
defineProps({
leftBtnText: {
type: String,
default: '修改上次记录'
},
rightBtnText: {
type: String,
default: '确认添加'
},
bgColor: {
type: String,
default: '#ffffff'
},
borderTop: {
type: String,
default: '0rpx'
},
zIndex: {
type: Number,
default: 88
},
isLastRecord: {
type: Boolean,
default: true
},
height: {
type: String,
default: '188rpx'
}
})
const leftClick = () => {
emits('leftClick')
}
const rightClick = () => {
emits('rightClick')
}
</script>
<style lang="scss">
.bottomBar {
position: fixed;
z-index: v-bind(zIndex);
left: 50%;
transform: translateX(-50%);
right: 0;
bottom: 0;
height: v-bind(height);
width: 750rpx;
border-top: v-bind(borderTop);
background-color: v-bind(bgColor);
.barBox {
@include flexcenter();
@include wrapPadding(16rpx, 16rpx);
@mixin commonBtn {
@include flexCj(center);
width: 328rpx;
height: 88rpx;
border-radius: 28rpx;
font-size: 32rpx;
font-weight: 700;
}
.cancel {
@include commonBtn();
margin-right: 30rpx;
background: #ffffff;
}
.save {
@include commonBtn();
color: #fff;
background: #15B959;
}
}
}
</style>