Zzc cf620dc8c9 feat(screen): 添加响应式Mixin以适应屏幕
添加SCSS和Less的Mixin,根据设计稿尺寸(宽度1920px,高度982px)将px单位转换为vw/vh单位。包含用于宽度、高度和字体大小转换的函数,以确保响应式设计。将SCSS的Mixin导入主样式索引。
2025-10-31 20:19:04 +08:00

23 lines
570 B
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 屏幕适配工具
// 设计稿基准1920px (宽) × 982px (高,不含头部)
// 将 px 转换为 vw (基于设计稿宽度 1920px)
@function vw($px) {
@return calc($px / 1920 * 100vw);
}
// 将 px 转换为 vh (基于设计稿内容区域高度 982px)
@function vh($px) {
@return calc($px / 982 * 100vh);
}
// 字体大小转换 (使用 vw 确保响应式)
@function fs($px) {
@return calc($px / 1920 * 100vw);
}
// 使用示例:
// width: vw(580); // 580px → vw
// height: vh(400); // 400px → vh
// font-size: fs(16); // 16px → vw