2021-03-26 12:01:15 +08:00
|
|
|
.#{$ns}Badge {
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&-text,
|
2021-11-01 10:14:25 +08:00
|
|
|
&-dot,
|
|
|
|
&-ribbon {
|
2021-03-26 12:01:15 +08:00
|
|
|
background: var(--danger);
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
transform: translate(50%, -50%);
|
|
|
|
transform-origin: 100% 0;
|
|
|
|
z-index: auto;
|
|
|
|
border-radius: calc(var(--Badge-size) / 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
&--top-left {
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: auto;
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&--bottom-left {
|
|
|
|
top: auto;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: auto;
|
|
|
|
transform: translate(-50%, 50%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&--bottom-right {
|
|
|
|
top: auto;
|
|
|
|
bottom: 0;
|
|
|
|
left: auto;
|
|
|
|
right: 0;
|
|
|
|
transform: translate(50%, 50%);
|
|
|
|
}
|
|
|
|
|
2021-10-29 16:15:20 +08:00
|
|
|
&--danger {
|
|
|
|
background: var(--Badge--danger-bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
&--info {
|
|
|
|
background: var(--Badge--info-bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
&--success {
|
|
|
|
background: var(--Badge--success-bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
&--warning {
|
|
|
|
background: var(--Badge--warning-bg);
|
|
|
|
}
|
2021-03-26 12:01:15 +08:00
|
|
|
// 显示文字
|
|
|
|
&-text {
|
|
|
|
color: var(--Badge-color);
|
|
|
|
height: var(--Badge-size);
|
|
|
|
line-height: var(--Badge-size);
|
|
|
|
white-space: nowrap;
|
|
|
|
text-align: center;
|
|
|
|
padding: 0 6px;
|
2022-12-05 20:03:09 +08:00
|
|
|
border: 1px solid #ffffff;
|
2021-03-26 12:01:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 只显示小红点
|
|
|
|
&-dot {
|
|
|
|
z-index: auto;
|
|
|
|
width: var(--Badge-size);
|
|
|
|
height: var(--Badge-size);
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
2021-08-24 14:17:45 +08:00
|
|
|
|
2021-11-01 10:14:25 +08:00
|
|
|
// 横幅
|
|
|
|
&-ribbon-out {
|
|
|
|
overflow: hidden;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
2022-12-05 20:03:09 +08:00
|
|
|
right: 0;
|
2021-11-01 10:14:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&-ribbon {
|
|
|
|
color: var(--Badge-color);
|
|
|
|
height: var(--Badge-size);
|
|
|
|
line-height: var(--Badge-size);
|
2022-12-05 20:03:09 +08:00
|
|
|
transform: translateX(calc(50% - 5px)) rotate(45deg) scale(0.7);
|
2021-11-01 10:14:25 +08:00
|
|
|
transform-origin: 50% 0;
|
|
|
|
border-radius: 0;
|
|
|
|
text-align: center;
|
|
|
|
width: px2rem(1000px);
|
|
|
|
top: 5px;
|
|
|
|
}
|
|
|
|
|
2022-12-05 20:03:09 +08:00
|
|
|
&-ribbon-out--top-left,
|
|
|
|
&-ribbon-out--bottom-left {
|
2021-11-01 10:14:25 +08:00
|
|
|
left: 0;
|
2022-12-05 20:03:09 +08:00
|
|
|
right: auto;
|
2021-11-01 10:14:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&-ribbon--top-left {
|
2022-12-05 20:03:09 +08:00
|
|
|
transform: translateX(calc(-50% + 5px)) rotate(-45deg) scale(0.7);
|
2021-11-01 10:14:25 +08:00
|
|
|
left: 0;
|
|
|
|
right: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-ribbon--bottom-left {
|
2022-12-05 20:03:09 +08:00
|
|
|
transform: translateX(calc(-50% + 5px)) rotate(45deg) scale(0.7);
|
2021-11-01 10:14:25 +08:00
|
|
|
transform-origin: 50% 100%;
|
|
|
|
left: 0;
|
|
|
|
right: auto;
|
|
|
|
bottom: 5px;
|
|
|
|
top: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-ribbon--bottom-right {
|
2022-12-05 20:03:09 +08:00
|
|
|
transform: translateX(calc(50% - 5px)) rotate(-45deg) scale(0.7);
|
2021-11-01 10:14:25 +08:00
|
|
|
transform-origin: 50% 100%;
|
|
|
|
left: auto;
|
|
|
|
right: 0;
|
|
|
|
bottom: 5px;
|
|
|
|
top: auto;
|
|
|
|
}
|
|
|
|
|
2021-08-24 14:17:45 +08:00
|
|
|
// 小红点的动画
|
|
|
|
@keyframes badgeDotAnimation {
|
|
|
|
0% {
|
|
|
|
transform: scale(0.8);
|
|
|
|
opacity: 0.4;
|
|
|
|
}
|
|
|
|
|
|
|
|
to {
|
|
|
|
transform: scale(3.2);
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|
2021-03-26 12:01:15 +08:00
|
|
|
}
|