提交代码
This commit is contained in:
@@ -6,6 +6,8 @@ withDefaults(
|
||||
title: string
|
||||
tone: 'blue' | 'orange' | 'green' | 'teal'
|
||||
icon: 'detect' | 'metal' | 'soil' | 'water'
|
||||
caption?: string
|
||||
index?: string
|
||||
}>(),
|
||||
{},
|
||||
)
|
||||
@@ -25,108 +27,195 @@ defineEmits<{
|
||||
<span class="module-button__icon">
|
||||
<ModuleIcon :name="icon" />
|
||||
</span>
|
||||
<span class="module-button__label">{{ title }}</span>
|
||||
<span v-if="index" class="module-button__index">{{ index }}</span>
|
||||
|
||||
<span class="module-button__body">
|
||||
<span class="module-button__label">{{ title }}</span>
|
||||
<span v-if="caption" class="module-button__caption">{{ caption }}</span>
|
||||
</span>
|
||||
|
||||
<span class="module-button__bar" aria-hidden="true"></span>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.module-button {
|
||||
--tone-1: #6fb0ff;
|
||||
--tone-2: #2f6fd0;
|
||||
--tone-glow: rgba(70, 140, 255, 0.28);
|
||||
--tone-line: rgba(111, 176, 255, 0.55);
|
||||
position: relative;
|
||||
display: block;
|
||||
height: 252px;
|
||||
overflow: hidden;
|
||||
border-radius: 18px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||
border-radius: 20px;
|
||||
text-align: left;
|
||||
background:
|
||||
radial-gradient(135% 105% at 106% -6%, var(--tone-glow) 0%, transparent 52%),
|
||||
linear-gradient(
|
||||
158deg,
|
||||
rgba(255, 255, 255, 0.08) 0%,
|
||||
rgba(255, 255, 255, 0.02) 58%,
|
||||
rgba(255, 255, 255, 0.045) 100%
|
||||
);
|
||||
box-shadow:
|
||||
0 16px 30px var(--module-shadow),
|
||||
inset 0 2px 0 rgba(255, 255, 255, 0.55),
|
||||
inset 0 -10px 24px rgba(0, 0, 0, 0.08);
|
||||
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
box-shadow 0.25s ease;
|
||||
0 18px 40px rgba(1, 8, 24, 0.42),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
||||
transition:
|
||||
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
border-color 0.3s ease,
|
||||
box-shadow 0.3s ease;
|
||||
}
|
||||
|
||||
/* 悬停时从左上扫过的高光 */
|
||||
.module-button::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
radial-gradient(ellipse 85% 65% at 18% 6%, rgba(255, 255, 255, 0.34) 0%, transparent 58%),
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 36%);
|
||||
inset: -40% -70%;
|
||||
background: linear-gradient(
|
||||
115deg,
|
||||
transparent 42%,
|
||||
rgba(255, 255, 255, 0.14) 50%,
|
||||
transparent 58%
|
||||
);
|
||||
transform: translateX(-62%);
|
||||
transition: transform 0.85s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.module-button::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 18px;
|
||||
bottom: 14px;
|
||||
left: 18px;
|
||||
height: 1px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
opacity: 0.8;
|
||||
.module-button:hover {
|
||||
border-color: var(--tone-line);
|
||||
box-shadow:
|
||||
0 26px 52px rgba(1, 8, 24, 0.55),
|
||||
0 0 0 1px var(--tone-glow),
|
||||
0 0 34px var(--tone-glow),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.14);
|
||||
transform: translateY(-6px);
|
||||
}
|
||||
|
||||
.module-button:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow:
|
||||
0 22px 38px var(--module-shadow-strong),
|
||||
inset 0 2px 0 rgba(255, 255, 255, 0.6),
|
||||
inset 0 -10px 24px rgba(0, 0, 0, 0.08);
|
||||
.module-button:hover::before {
|
||||
transform: translateX(62%);
|
||||
}
|
||||
|
||||
.module-button:active {
|
||||
transform: translateY(-1px) scale(0.995);
|
||||
transform: translateY(-2px) scale(0.995);
|
||||
}
|
||||
|
||||
.module-button--blue {
|
||||
--module-shadow: rgba(47, 111, 208, 0.26);
|
||||
--module-shadow-strong: rgba(47, 111, 208, 0.38);
|
||||
background: linear-gradient(145deg, #4b8ae8 0%, #3778d9 48%, #2f6fd0 100%);
|
||||
--tone-1: #6fb0ff;
|
||||
--tone-2: #2f6fd0;
|
||||
--tone-glow: rgba(70, 140, 255, 0.28);
|
||||
--tone-line: rgba(111, 176, 255, 0.55);
|
||||
}
|
||||
|
||||
.module-button--orange {
|
||||
--module-shadow: rgba(238, 166, 11, 0.28);
|
||||
--module-shadow-strong: rgba(238, 166, 11, 0.4);
|
||||
background: linear-gradient(145deg, #ffc845 0%, #f8b526 50%, #eea50b 100%);
|
||||
--tone-1: #ffd166;
|
||||
--tone-2: #e08f00;
|
||||
--tone-glow: rgba(255, 176, 32, 0.24);
|
||||
--tone-line: rgba(255, 203, 92, 0.5);
|
||||
}
|
||||
|
||||
.module-button--green {
|
||||
--module-shadow: rgba(107, 171, 49, 0.28);
|
||||
--module-shadow-strong: rgba(107, 171, 49, 0.4);
|
||||
background: linear-gradient(145deg, #91d258 0%, #7cc242 50%, #67ad2f 100%);
|
||||
--tone-1: #a4e56f;
|
||||
--tone-2: #4f9a26;
|
||||
--tone-glow: rgba(118, 200, 60, 0.22);
|
||||
--tone-line: rgba(164, 229, 111, 0.5);
|
||||
}
|
||||
|
||||
.module-button--teal {
|
||||
--module-shadow: rgba(38, 174, 163, 0.28);
|
||||
--module-shadow-strong: rgba(38, 174, 163, 0.4);
|
||||
background: linear-gradient(145deg, #46cec2 0%, #2fb8ac 50%, #22a99e 100%);
|
||||
--tone-1: #5ce3d6;
|
||||
--tone-2: #109c91;
|
||||
--tone-glow: rgba(40, 200, 188, 0.24);
|
||||
--tone-line: rgba(92, 227, 214, 0.5);
|
||||
}
|
||||
|
||||
.module-button__icon {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
left: 24px;
|
||||
top: 26px;
|
||||
left: 28px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 92px;
|
||||
height: 92px;
|
||||
padding: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.36);
|
||||
border-radius: 16px;
|
||||
background: rgba(255, 255, 255, 0.14);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
|
||||
width: 86px;
|
||||
height: 86px;
|
||||
border-radius: 22px;
|
||||
color: #f4f9ff;
|
||||
background: linear-gradient(150deg, var(--tone-1) 0%, var(--tone-2) 100%);
|
||||
box-shadow:
|
||||
0 14px 28px var(--tone-glow),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||
transition:
|
||||
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
box-shadow 0.3s ease;
|
||||
}
|
||||
|
||||
.module-button__icon :deep(svg) {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
filter: drop-shadow(0 2px 6px rgba(4, 16, 40, 0.35));
|
||||
}
|
||||
|
||||
.module-button:hover .module-button__icon {
|
||||
box-shadow:
|
||||
0 18px 34px var(--tone-glow),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
||||
transform: scale(1.06);
|
||||
}
|
||||
|
||||
.module-button__index {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 28px;
|
||||
color: rgba(255, 255, 255, 0.1);
|
||||
font-size: 46px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.module-button__body {
|
||||
position: absolute;
|
||||
right: 28px;
|
||||
bottom: 32px;
|
||||
left: 28px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.module-button__label {
|
||||
position: absolute;
|
||||
right: 18px;
|
||||
bottom: 44px;
|
||||
left: 18px;
|
||||
color: #fff;
|
||||
font-size: 31px;
|
||||
color: #f3f8ff;
|
||||
font-size: 30px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 4px;
|
||||
text-align: center;
|
||||
text-shadow: 0 2px 5px rgba(33, 49, 79, 0.24);
|
||||
letter-spacing: 3px;
|
||||
line-height: 1.25;
|
||||
text-shadow: 0 2px 12px rgba(2, 10, 30, 0.45);
|
||||
}
|
||||
|
||||
.module-button__caption {
|
||||
color: var(--tone-1);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 2.6px;
|
||||
opacity: 0.85;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.module-button__bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 42%;
|
||||
height: 3px;
|
||||
border-radius: 0 3px 3px 0;
|
||||
background: linear-gradient(90deg, var(--tone-1), transparent);
|
||||
opacity: 0.55;
|
||||
transition: width 0.4s ease, opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.module-button:hover .module-button__bar {
|
||||
width: 100%;
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user