chat-app/src/components/custom-btn/custom-btn.vue

86 lines
2.0 KiB
Vue
Raw Normal View History

<template>
<div
class="custom-btn"
:class="[
props.isBottom ? 'custom-btn-bottom' : '',
props.subBtnText ? 'apposition-btn-style' : '',
]"
>
<wd-button custom-class="custom-sub-btn-class" v-if="props.subBtnText">
{{ props.subBtnText }}
</wd-button>
<wd-button
custom-class="custom-btn-class"
@click="clickBtn"
:disabled="props?.disabled"
:class="[props?.disabled ? 'custom-btn-class-disabled' : '']"
>
{{ props.btnText }}
</wd-button>
</div>
</template>
<script setup>
import { reactive } from 'vue'
import { defineProps, defineEmits } from 'vue'
const state = reactive({})
const emits = defineEmits(['clickBtn'])
const props = defineProps({
isBottom: false, //是否底部按钮
btnText: '', //按钮文字
subBtnText: '', //次要按钮文字
disabled: false, //是否禁用
})
//点击
const clickBtn = () => {
emits('clickBtn')
}
</script>
<style scoped lang="scss">
.custom-btn {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.custom-sub-btn-class {
background-color: #eee9f8;
padding: 18rpx 185rpx;
border-radius: 8rpx;
box-shadow: 0 6px 12px 2px rgba(188, 188, 188, 0.08);
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
color: $theme-primary;
}
.custom-btn-class {
background-color: $theme-primary;
padding: 18rpx 185rpx;
border-radius: 8rpx;
box-shadow: 0 6px 12px 2px rgba(188, 188, 188, 0.08);
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
}
}
.custom-btn-bottom {
width: 100%;
background-color: #fff;
padding: 14rpx 0 72rpx;
box-shadow: 0 1px 0 2px rgba(231, 231, 231, 1);
}
.apposition-btn-style {
padding: 14rpx 30rpx 72rpx;
.custom-sub-btn-class {
padding: 18rpx 124rpx;
margin: 0 20rpx 0 0;
}
.custom-btn-class {
padding: 18rpx 124rpx;
}
}
.custom-btn-class-disabled {
background-color: #e6e6e6 !important;
color: #bebebe !important;
}
</style>