@import '../common/style/index.less'; @badge-text-color: @text-anti-primary-color; @badge-color: #e34d59; @badge-font-size: @font-size-xs; @badge-height: 32rpx; @badge-width: 32rpx; @badge-font-weight: normal; @badge-circle-border-radius: 32rpx; @badge-round-border-radius: 8rpx; @badge-dot-height: 20rpx; @badge-dot-border-radius: 8rpx; // 替换为组件名 .@{prefix}-badge { position: relative; display: inline-block; &--basic { display: inline-block; z-index: 100; font-size: @badge-font-size; color: @badge-text-color; background-color: @badge-color; height: @badge-height; padding: 0 8rpx; text-align: center; line-height: @badge-height; font-weight: @badge-font-weight; } &--dot { height: @badge-dot-height; border-radius: @badge-dot-border-radius; min-width: @badge-dot-height; padding: 0; } &--count { min-width: @badge-width; white-space: nowrap; box-sizing: border-box; } &--small { transform: translate(50%, -50%) scale(0.75); } &--circle { border-radius: @badge-circle-border-radius; } &--round { border-radius: @badge-round-border-radius; } // 绸带外层样式,用于定位 &__ribbon--outer { position: absolute; top: 0; right: 0; } &--ribbon { transform: rotate(45deg); // padding: 0; &::before { content: ''; position: absolute; width: 0; height: 0; bottom: 0; left: -@badge-height; border-bottom: @badge-height solid @badge-color; border-left: @badge-height solid transparent; } &::after { content: ''; position: absolute; width: 0; height: 0; bottom: 0; right: -@badge-height; border-bottom: @badge-height solid @badge-color; border-right: @badge-height solid transparent; } } &__content:not(:empty) + .t-has-count { transform: translate(50%, -50%); position: absolute; right: 0; top: 0; } }