🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
全局样式参数 Code 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 /* 全局色彩 */ $color-primary: #ADB838; $color-success: #4cd964; $color-warning: #FAB714; $color-error: #D12E32; /* 文字基本颜色 */ $text-color-base: #5A5B5C; //基本色 $text-color-assist: #919293; //辅助色 $text-color-black: #3B3C3E; //黑 $text-color-grey: #878889; //灰 $text-color-white: #ffffff; //白 /* 背景颜色 */ $bg-color: #F1F8FA; $bg-color-grey: #F5F5F5; $bg-color-primary: #E8EACF; /* 边框颜色 */ $border-color:#e2e2e2; /* 尺寸变量 */ /* 文字尺寸 */ $font-size-sm:24rpx; $font-size-base:28rpx; $font-size-lg:32rpx; /* 图片尺寸 */ $img-size-sm:40rpx; $img-size-base:52rpx; $img-size-lg:80rpx; /* Border Radius */ $border-radius-sm: 4rpx; $border-radius-base: 6rpx; $border-radius-lg: 12rpx; $border-radius-circle: 50%; /* 水平间距 */ $spacing-row-sm: 10px; $spacing-row-base: 20rpx; $spacing-row-lg: 30rpx; /* 垂直间距 */ $spacing-col-sm: 8rpx; $spacing-col-base: 16rpx; $spacing-col-lg: 24rpx; /* 透明度 */ $opacity-disabled: 0.3; // 组件禁用态的透明度 /* 文章场景相关 */ $color-title: #2C405A; // 文章标题颜色 $font-size-title:40rpx; $color-subtitle: #555555; // 二级标题颜色 $font-size-subtitle:36rpx; $color-paragraph: #3F536E; // 文章段落颜色 $font-size-paragraph:30rpx; $box-shadow: 0 20rpx 20rpx -20rpx rgba($color: #333, $alpha: 0.1); app.scss定义全局基础样式 Code @import '~@/uni.scss'; page, view, scroll-view, text, image, textarea, button, input { box-sizing: border-box; } page { background-color: #F1F8FA; height: 100%; } .container { width: 100%; height: 100%; } button { margin: 0; ​ &[type='primary'] { ​ background-color: $color-primary; ​ color: #ffffff; ​ font-size: $font-size-base; ​ ​ &[disabled] { ​ background-color: #D1D78C; ​ } ​ ​ &[plain] { ​ color: $color-primary; ​ border: 1rpx solid $color-primary; ​ } ​ &.button-hover { ​ background-color: #d5da91; ​ } ​ &::after { ​ border: 0; ​ } ​ } ​ &[type='default'] { ​ &[plain] { ​ color: $text-color-assist; ​ border: 1rpx solid $text-color-assist; ​ } ​ } } .bg-base { background-color: $bg-color; } .bg-white { background-color: #ffffff; } .bg-transparent { background-color: transparent !important; } .bg-primary { background-color: $color-primary; } .bg-warning { background-color: $color-warning; } .d-flex { display: flex; } .d-none { display: none !important; } .invisible { visibility: hidden !important; } .d-inline { display: inline !important; } .d-inline-block { display: inline-block !important; } .d-block { display: block !important; } .flex-column { -ms-flex-direction: column !important; flex-direction: column !important; } .justify-content-start { justify-content: flex-start; } .justify-content-end { justify-content: flex-end; } .justify-content-between { justify-content: space-between; } .just-content-center { justify-content: center; } .justify-content-evenly { justify-content: space-evenly !important; } .just-content-around { justify-content: space-around; } .align-items-start { align-items: flex-start; } .align-items-end { align-items: flex-end; } .align-items-center { align-items: center; } .align-items-between { align-items: space-between; } .align-items-around { align-items: space-around; } .align-items-stretch { align-items: stretch; } .align-items-baseline { -ms-flex-align: baseline !important; align-items: baseline !important; } .flex-fill { -ms-flex: 1 1 auto !important; flex: 1 1 auto !important; } .flex-wrap { -ms-flex-wrap: wrap !important; flex-wrap: wrap !important; } .flex-nowrap { -ms-flex-wrap: nowrap !important; flex-wrap: nowrap !important; } .flex-shrink-0 { -ms-flex-negative: 0 !important; flex-shrink: 0 !important; } .font-size-base { font-size: 28rpx; } .font-size-sm { font-size: 24rpx; } .font-size-medium { font-size: 26rpx; } .font-size-lg { font-size: 32rpx; } .font-size-extra-lg { font-size: 40rpx; } .text-color-base { color: $text-color-base; } .text-color-assist { color: $text-color-assist; } .text-color-primary { color: $color-primary; } .text-color-danger { color: $color-error; } .text-color-white { color: #ffffff; } .text-color-warning { color: $color-warning; } .text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .font-weight-bold { font-weight: 700 !important; } .font-weight-light { font-weight: 300 !important; } .font-weight-lighter { font-weight: lighter !important; } .font-weight-normal { font-weight: 400 !important; } .overflow-auto { overflow: auto !important; } .overflow-hidden { overflow: hidden !important; } .position-relative { position: relative !important; } .position-absolute { position: absolute !important; } .position-fixed { position: fixed !important; } .fixed-top { position: fixed; top: 0; right: 0; left: 0; z-index: 1030; } .fixed-bottom { position: fixed; right: 0; bottom: 0; left: 0; z-index: 1030; } .line-height-100 { line-height: 100%; } .line-height-2 { line-height: 2rem !important; } .line-height-50 { line-height: 50rem !important; } .w-25 { width: 25% !important; } .w-50 { width: 50% !important; } .w-75 { width: 75% !important; } .w-80 { width: 80% !important; } .w-100 { width: 100% !important; } .h-100 { height: 100% !important; } .text-left { text-align: left !important; } .text-right { text-align: right !important; } .text-center { text-align: center !important; } .border-box { box-sizing: border-box; } .rounded-circle { border-radius: 50% !important; } .rounded-pill { border-radius: 50rem !important; } .pre-line { white-space: pre-line; } .align-top { vertical-align: top !important; } .align-middle { vertical-align: middle !important; } .align-bottom { vertical-align: bottom !important; } .align-text-bottom { vertical-align: text-bottom !important; } .align-text-top { vertical-align: text-top !important; } .w-60 { width: 60%; } .w-40 { width: 40%; } .mb-10 { margin-bottom: 10rpx; } .mb-20 { margin-bottom: 20rpx; } .mb-30 { margin-bottom: 30rpx; } .mb-40 { margin-bottom: 40rpx; } .mb-50 { margin-bottom: 50rpx; } .mt-30 { margin-top: 30rpx; } .ml-10 { margin-left: 10rpx; } .ml-20 { margin-left: 20rpx; } .ml-30 { margin-left: 30rpx; } .mr-10 { margin-right: 10rpx; } .mr-20 { margin-right: 20rpx; } .mr-30 { margin-right: 30rpx; } .mr-40 { margin-right: 40rpx; } .pl-30 { padding-left: 30rpx; } 工具 -加载scss预编辑器插件 然后在App.vue 中 import app.scss