Files
shoot-miniprograms/src/components/SButton.vue

56 lines
872 B
Vue
Raw Normal View History

2025-05-10 16:57:36 +08:00
<script setup>
const props = defineProps({
width: {
type: String,
default: "calc(100vw - 20px)",
},
rounded: {
type: Number,
default: 10,
},
onClick: {
type: Function,
default: () => {},
},
2025-05-31 18:39:41 +08:00
disabled: {
type: Boolean,
default: false,
},
2025-05-10 16:57:36 +08:00
});
</script>
<template>
2025-06-15 15:53:57 +08:00
<button
2025-05-26 16:28:13 +08:00
class="sbtn"
2025-06-15 15:53:57 +08:00
hover-class="none"
2025-05-31 18:39:41 +08:00
:style="{
width: width,
borderRadius: rounded + 'px',
backgroundColor: disabled ? '#757575' : '#fed847',
}"
2025-06-15 15:53:57 +08:00
open-type="getUserInfo"
2025-05-31 18:39:41 +08:00
@click="
() => {
if (!disabled) onClick();
}
"
2025-05-10 16:57:36 +08:00
>
<slot />
2025-06-15 15:53:57 +08:00
</button>
2025-05-10 16:57:36 +08:00
</template>
<style scoped>
2025-05-26 16:28:13 +08:00
.sbtn {
2025-05-10 16:57:36 +08:00
margin: 0 auto;
height: 40px;
line-height: 40px;
font-weight: bold;
font-size: 15px;
text-align: center;
2025-05-26 16:28:13 +08:00
display: flex;
justify-content: center;
align-items: center;
2025-06-15 20:55:34 +08:00
color: #000;
2025-05-10 16:57:36 +08:00
}
</style>