2026-06-12 11:49:22 +08:00
|
|
|
<template>
|
|
|
|
|
<el-button
|
|
|
|
|
:class="['custom-button', `custom-button--${type}`]"
|
|
|
|
|
v-bind="$attrs"
|
|
|
|
|
@click="$emit('click', $event)"
|
|
|
|
|
>
|
|
|
|
|
<slot />
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: 'CustomButton',
|
|
|
|
|
props: {
|
|
|
|
|
type: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'default',
|
2026-06-23 14:14:29 +08:00
|
|
|
validator: (val) => ['default', 'confirm', 'delete', 'add'].includes(val)
|
2026-06-12 11:49:22 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.custom-button--default {
|
2026-06-15 15:44:09 +08:00
|
|
|
width: fit-content;
|
|
|
|
|
background: #4998ff;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
border: none;
|
2026-06-23 14:54:45 +08:00
|
|
|
border-radius: 4px;
|
2026-06-12 11:49:22 +08:00
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
|
|
&.el-button--small {
|
2026-06-23 14:54:45 +08:00
|
|
|
padding: 9px 14px;
|
|
|
|
|
font-size: 12px;
|
2026-06-12 11:49:22 +08:00
|
|
|
}
|
2026-06-15 15:44:09 +08:00
|
|
|
&.el-button--medium {
|
|
|
|
|
padding: 12px 20px;
|
|
|
|
|
}
|
2026-06-12 11:49:22 +08:00
|
|
|
|
|
|
|
|
&:hover {
|
2026-06-15 15:44:09 +08:00
|
|
|
background: #62a4fc;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(74, 124, 253, 0.2);
|
2026-06-12 14:13:21 +08:00
|
|
|
transform: translateY(-2px);
|
2026-06-12 11:49:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.is-disabled,
|
|
|
|
|
&.is-disabled:hover {
|
2026-06-15 15:44:09 +08:00
|
|
|
background: linear-gradient(to right, #f0f3fe, #f5f6fe);
|
|
|
|
|
color: rgba(74, 124, 253, 0.5);
|
|
|
|
|
border-color: transparent;
|
2026-06-12 11:49:22 +08:00
|
|
|
box-shadow: none;
|
|
|
|
|
transform: none;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-button--confirm {
|
|
|
|
|
width: fit-content;
|
|
|
|
|
background: linear-gradient(to right, #4a7cfd, #8154fc);
|
|
|
|
|
color: white;
|
|
|
|
|
border: none;
|
2026-06-23 14:54:45 +08:00
|
|
|
border-radius: 4px;
|
2026-06-12 11:49:22 +08:00
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
|
|
&.el-button--small {
|
2026-06-23 14:54:45 +08:00
|
|
|
padding: 9px 14px;
|
|
|
|
|
font-size: 12px;
|
2026-06-12 11:49:22 +08:00
|
|
|
}
|
2026-06-15 15:44:09 +08:00
|
|
|
&.el-button--medium {
|
|
|
|
|
padding: 12px 20px;
|
|
|
|
|
}
|
2026-06-12 11:49:22 +08:00
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
color: white;
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(74, 124, 253, 0.3);
|
2026-06-12 14:13:21 +08:00
|
|
|
transform: translateY(-2px);
|
2026-06-12 11:49:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.is-disabled,
|
|
|
|
|
&.is-disabled:hover {
|
|
|
|
|
background: linear-gradient(to right, #a0b4fd, #b8a4fd);
|
|
|
|
|
color: rgba(255, 255, 255, 0.6);
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
transform: none;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-06-15 15:44:09 +08:00
|
|
|
|
|
|
|
|
.custom-button--delete {
|
|
|
|
|
width: fit-content;
|
2026-06-18 16:49:15 +08:00
|
|
|
background: #ff6b6b;
|
2026-06-15 15:44:09 +08:00
|
|
|
color: white;
|
|
|
|
|
border: none;
|
2026-06-23 14:54:45 +08:00
|
|
|
border-radius: 4px;
|
2026-06-15 15:44:09 +08:00
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
|
|
&.el-button--small {
|
2026-06-23 14:54:45 +08:00
|
|
|
padding: 9px 14px;
|
|
|
|
|
font-size: 12px;
|
2026-06-15 15:44:09 +08:00
|
|
|
}
|
|
|
|
|
&.el-button--medium {
|
|
|
|
|
padding: 12px 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
color: white;
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
|
|
|
|
|
transform: translateY(-2px);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.is-disabled,
|
|
|
|
|
&.is-disabled:hover {
|
|
|
|
|
background: linear-gradient(to right, #ffaaaa, #ffcaca);
|
|
|
|
|
color: rgba(255, 255, 255, 0.6);
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
transform: none;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-06-23 14:14:29 +08:00
|
|
|
|
|
|
|
|
.custom-button--add {
|
|
|
|
|
width: fit-content;
|
|
|
|
|
background: #52c41a;
|
|
|
|
|
color: white;
|
|
|
|
|
border: none;
|
2026-06-23 14:54:45 +08:00
|
|
|
border-radius: 4px;
|
2026-06-23 14:14:29 +08:00
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
|
|
&.el-button--small {
|
2026-06-23 14:54:45 +08:00
|
|
|
padding: 9px 14px;
|
|
|
|
|
font-size: 12px;
|
2026-06-23 14:14:29 +08:00
|
|
|
}
|
|
|
|
|
&.el-button--medium {
|
|
|
|
|
padding: 12px 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
color: white;
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
|
|
|
|
|
transform: translateY(-2px);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.is-disabled,
|
|
|
|
|
&.is-disabled:hover {
|
|
|
|
|
background: linear-gradient(to right, #a0e89a, #c4f0c0);
|
|
|
|
|
color: rgba(255, 255, 255, 0.6);
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
transform: none;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-06-12 11:49:22 +08:00
|
|
|
</style>
|