@button-default-height: 92rpx; @button-border-radius: 16rpx; @button-default-font-size: 32rpx; @button-default-color: #fff; wx-button:not([size=mini]) { margin-left: auto; margin-right: auto; width: auto; } .toy-button { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; height: @button-default-height; line-height: @button-default-height; border-radius: @button-border-radius; font-size: @button-default-font-size; color: @button-default-color; padding: 0 24rpx; font-weight: 600; text-align: center; cursor: pointer; transition: all 0.15s ease-in-out; border: none; &--primary { background: #FFD719; box-shadow: 0 4rpx 12rpx rgba(255, 215, 25, 0.3); color: #141414; &.disabled { background: #F5F5F5; color: #CCCCCC; box-shadow: none; } &.active { transform: scale(0.92); box-shadow: 0 2rpx 6rpx rgba(255, 215, 25, 0.2); animation: buttonPress 0.15s ease-in-out; } } &--green { background: #93D333; box-shadow: 0 4rpx 12rpx rgba(147, 211, 51, 0.3); color: #FFFFFF; &.disabled { background: #F5F5F5; color: #CCCCCC; box-shadow: none; } &.active { transform: scale(0.92); box-shadow: 0 2rpx 6rpx rgba(147, 211, 51, 0.2); animation: buttonPress 0.15s ease-in-out; } } &--secondary { background: #93D333; box-shadow: 0 4rpx 12rpx rgba(147, 211, 51, 0.3); color: #FFFFFF; &.disabled { background: #F5F5F5; color: #CCCCCC; box-shadow: none; } &.active { transform: scale(0.92); box-shadow: 0 2rpx 6rpx rgba(147, 211, 51, 0.2); animation: buttonPress 0.15s ease-in-out; } } &--white { background: #FFFFFF; border: 1rpx solid #E8E8E8; color: #141414; &.disabled { background: #F5F5F5; color: #CCCCCC; border-color: #E8E8E8; } &.plain { color: #FFFFFF; background: transparent; border: 1rpx solid #FFFFFF; } &.active { transform: scale(0.92); background: #F8F8F8; animation: buttonPress 0.15s ease-in-out; } } &--flat { box-shadow: none !important; border: none !important; transition: all 0.15s ease-in-out; // 覆盖所有颜色变体 &.toy-button--primary, &.toy-button--green, &.toy-button--secondary, &.toy-button--white { box-shadow: none !important; border: none !important; &.active { transform: scale(0.92) !important; animation: buttonPress 0.15s ease-in-out !important; } } // 特殊处理白色plain模式 &.toy-button--white.plain { background: transparent !important; border: none !important; box-shadow: none !important; } // 彩色按钮active背景变化 &.toy-button--primary.active { background: rgba(255, 215, 25, 0.8); } &.toy-button--green.active { background: rgba(147, 211, 51, 0.8); } &.toy-button--secondary.active { background: rgba(147, 211, 51, 0.8); } &.toy-button--white.active { background: rgba(255, 255, 255, 0.8); } } .loading-class, &__icon { margin-right: 12rpx; } // 添加按钮点击动画类 &.button-press { animation: buttonPress 0.15s ease-in-out; } } // 按钮点击动画 @keyframes buttonPress { 0% { transform: scale(1); } 25% { transform: scale(0.92); } 50% { transform: scale(0.98); } 75% { transform: scale(0.92); } 100% { transform: scale(1); } }