/** * SCSS 混入 */ @use './variables.scss' as *; // 响应式断点 @mixin mobile { @media (max-width: #{$breakpoint-mobile}) { @content; } } @mixin tablet { @media (min-width: #{$breakpoint-mobile + 1}) and (max-width: #{$breakpoint-tablet}) { @content; } } @mixin desktop { @media (min-width: #{$breakpoint-tablet + 1}) { @content; } } // Flexbox 居中 @mixin flex-center { display: flex; align-items: center; justify-content: center; } // 文本截断 @mixin text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } // 多行文本截断 @mixin text-ellipsis-multiline($lines: 2) { display: -webkit-box; -webkit-line-clamp: $lines; -webkit-box-orient: vertical; overflow: hidden; } // 按钮重置 @mixin button-reset { border: none; background: none; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; outline: none; &:focus { outline: 2px solid $primary-color; outline-offset: 2px; } }