zjk
2026-07-29 429208957f30ab9eedc5533a81aaa284048d09f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.universal-toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  // 默认不拦截页面点击,仅在开启 mask 时由蒙层拦截
  pointer-events: none;
 
  &__mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: auto;
  }
 
  &__box {
    max-width: 560rpx;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 24rpx 40rpx;
    border-radius: 16rpx;
    background: rgba(0, 0, 0, 0.8);
    pointer-events: auto;
 
    // 无图标:纯文本样式,横向内边距略小
    &.text-only {
      padding: 24rpx 32rpx;
    }
  }
 
  &__icon {
    flex-shrink: 0;
    width: 40rpx;
    height: 40rpx;
    margin-right: 12rpx;
 
    // 加载中图标旋转动画
    &.is-loading {
      animation: universal-toast-spin 0.8s linear infinite;
    }
  }
 
  &__title {
    font-family: PingFang SC;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 40rpx;
    text-align: center;
    color: #ffffff;
    // 支持一行 / 两行文本自动换行
    word-break: break-all;
  }
}
 
@keyframes universal-toast-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}