Files
MER-2.2_2601/mer_uniapp/components/bottomButton/index.vue
2026-03-08 20:07:52 +08:00

80 lines
1.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="form-btn-group" :class="type === 'short' ?'flex justify-end':''">
<button class="form-btn-group__btn" :class="btnClass" :style="[btnStyle]" @click="onConfirm">{{title}}</button>
</view>
</template>
<script>
export default {
name: "index",
props:{
title: {
type: String,
default: '确定',
},
widthNum: {
type: String,
default: 'auto',
},
backgroundColor: {
type: String,
default: '#2291F8'
},
// btn样式长还是短的
type: {
type: String,
default: 'long',
}
},
computed: {
btnClass() {
return this.type === 'short' ? 'confirm-short' : 'confirm-long'
},
btnStyle() {
return {
width: this.widthNum,
background: this.backgroundColor
}
}
},
methods: {
onConfirm() {
this.$emit('handleConfirm')
}
}
}
</script>
<style scoped lang="scss">
$btn-height: calc(110rpx + var(--safe-area-inset-bottom));
.form-btn-group {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: $btn-height;
background-color: #fff;
padding: 20rpx 30rpx;
padding-bottom: var(--safe-area-inset-bottom);
&__btn {
height: 88rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 43rpx;
font-weight: 500;
&.confirm-long {
// background: #2291F8;
color: #fff;
font-size: 28rpx;
}
&.confirm-short {
border: 1px solid #CCCCCC;
color: #333333;
font-size: 24rpx;
}
}
}
</style>