跳到主要内容

全局样式

duxapp模块提供了全局样式,可以用于快速布局,如果你还不知到如何使用全局样式,请查看这篇文章 使用全局样式布局

下面是duxapp模块中的全局样式

/*  #ifndef rn h5  */
page {
height: 100vh;
}

/* #endif */

/* #ifdef h5 */
.taro_page {
height: 100vh;
}

/* #endif */


/* #ifdef h5 */
taro-view-core {
display: flex;
flex-direction: column;
position: relative;
border-style: solid;
border-width: 0;
}
input,
textarea,
taro-view-core {
box-sizing: border-box;
}
taro-view-core,
taro-text-core {
line-height: 1;
}
taro-image-core {
width: auto;
height: auto;
}
/* #endif */
/* #ifndef rn h5 */
view {
display: flex;
flex-direction: column;
position: relative;
border-style: solid;
border-width: 0;
}
input,
textarea,
view {
box-sizing: border-box;
}
view,
text {
line-height: 1;
}
/* #endif */

/* #ifdef h5 */
taro-input-core {
position: relative;

input {
position: absolute;
transform: translateY(-50%);
top: 50%;
}
}

/* #endif */

/* #ifdef weapp */
.button-clean {
position: relative;
display: flex;
flex-direction: column;
margin-left: initial;
margin-right: initial;
padding-left: initial;
padding-right: initial;
line-height: initial;
font-size: initial;
background-color: initial;
border: initial;
padding: 0;
box-sizing: border-box;
text-decoration: none;
border-radius: 0;
-webkit-tap-highlight-color: transparent;
color: transparent;

&::after {
border: none;
}
}

/* #endif */

.bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}

/* overflow */
.overflow-hidden {
overflow: hidden;
}

/* 定位 */
.absolute {
position: absolute;
}

.inset-0 {
top: 0;
bottom: 0;
right: 0;
left: 0;
}

.top-0 {
top: 0;
}

.right-0 {
right: 0;
}

.bottom-0 {
bottom: 0;
}

.left-0 {
left: 0;
}

/* z-index */

.z-0 {
z-index: 0;
}

.z-1 {
z-index: 1;
}

.z-2 {
z-index: 2;
}

/* flex */
.flex-row {
flex-direction: row;
}

.flex-row-reverse {
flex-direction: row-reverse;
}

.flex-col-reverse {
flex-direction: column-reverse;
}

.flex-wrap {
flex-wrap: wrap;
}

.flex-wrap-reverse {
flex-wrap: wrap-reverse;
}

.flex-grow {
flex: 1;
}

.flex-shrink {
flex-shrink: 0;
}

.justify-end {
justify-content: flex-end;
}

.justify-center {
justify-content: center;
}

.justify-between {
justify-content: space-between;
}

.justify-around {
justify-content: space-around;
}

.justify-evenly {
justify-content: space-evenly;
}

.content-center {
align-content: center;
}

.content-start {
align-content: flex-start;
}

.content-end {
align-content: flex-end;
}

.content-between {
align-content: space-between;
}

.content-around {
align-content: space-around;
}

.items-start {
align-items: flex-start;
}

.items-end {
align-items: flex-end;
}

.items-center {
align-items: center;
}

.items-baseline {
align-items: baseline;
}

.self-start {
align-self: flex-start;
}

.self-end {
align-self: flex-end;
}

.self-center {
align-self: center;
}

.self-stretch {
align-self: stretch;
}

.self-baseline {
align-self: baseline;
}

/* size */
.w-full {
width: 100%;
}

.h-full {
height: 100%;
}

.w-0 {
width: 0;
}

.h-0 {
height: 0;
}

/* 斜体 */
.italic {
font-style: italic;
}

/* 加粗 */
.bold {
font-weight: bold;
}

/* 文本对齐 */
.text-left {
text-align: left;
}

.text-center {
text-align: center;
}

.text-right {
text-align: right;
}

.text-justify {
text-align: justify;
}

/* 文本颜色 */
.text-transparent {
color: transparent;
}

.text-black {
color: #000;
}

.text-white {
color: #fff;
}

.text-c1 {
color: $duxappTextColor1;
}

.text-c2 {
color: $duxappTextColor2;
}

.text-c3 {
color: $duxappTextColor3;
}

.text-c4 {
color: $duxappTextColor4;
}

.text-primary {
color: $duxappPrimaryColor;
}

.text-secondary {
color: $duxappSecondaryColor;
}

.text-success {
color: $duxappSuccessColor;
}

.text-danger {
color: $duxappDangerColor;
}

.text-warning {
color: $duxappWarningColor;
}

// 文本尺寸
.text-s1 {
font-size: $duxappTextSize1;
}

.text-s2 {
font-size: $duxappTextSize2;
}

.text-s3 {
font-size: $duxappTextSize3;
}

.text-s4 {
font-size: $duxappTextSize4;
}

.text-s5 {
font-size: $duxappTextSize5;
}

.text-s6 {
font-size: $duxappTextSize6;
}

.text-s7 {
font-size: $duxappTextSize7;
}

/* 文本装饰 */
.underline {
text-decoration: underline;
}

.line-through {
text-decoration: line-through;
}

/* 文本转换 */
.uppercase {
text-transform: uppercase;
}

.lowercase {
text-transform: lowercase;
}

.capitalize {
text-transform: capitalize;
}

/* 边框颜色 */
.border-black {
border-color: #000;
}

.border-white {
border-color: #fff;
}

.border-primary {
border-color: $duxappPrimaryColor;
}

.border-secondary {
border-color: $duxappSecondaryColor;
}

.border-success {
border-color: $duxappSuccessColor;
}

.border-danger {
border-color: $duxappDangerColor;
}

.border-warning {
border-color: $duxappWarningColor;
}

// 边框宽度
.border-w1 {
border-width: 2px;
}

/* 边框样式 */
.border-dotted {
border-style: dotted;
}

.border-dashed {
border-style: dashed;
}

// 内边距
.p-1 {
padding: 8px;
}

.p-2 {
padding: 16px;
}

.p-3 {
padding: 24px;
}

.pv-1 {
padding-top: 8px;
padding-bottom: 8px;
}

.pv-2 {
padding-top: 16px;
padding-bottom: 16px;
}

.pv-3 {
padding-top: 24px;
padding-bottom: 24px;
}

.ph-1 {
padding-left: 8px;
padding-right: 8px;
}

.ph-2 {
padding-left: 16px;
padding-right: 16px;
}

.ph-3 {
padding-left: 24px;
padding-right: 24px;
}

// 外边距
.m-1 {
margin: 8px;
}

.m-2 {
margin: 16px;
}

.m-3 {
margin: 24px;
}

.mv-1 {
margin-top: 8px;
margin-bottom: 8px;
}

.mv-2 {
margin-top: 16px;
margin-bottom: 16px;
}

.mv-3 {
margin-top: 24px;
margin-bottom: 24px;
}

.mt-1 {
margin-top: 8px;
}

.mt-2 {
margin-top: 16px;
}

.mt-3 {
margin-top: 24px;
}

.mt-3 {
margin-top: 32px;
}

.mh-1 {
margin-left: 8px;
margin-right: 8px;
}

.mh-2 {
margin-left: 16px;
margin-right: 16px;
}

.mh-3 {
margin-left: 24px;
margin-right: 24px;
}

// 圆角
.r-1 {
border-radius: 8px;
}

.r-2 {
border-radius: 16px;
}

.r-3 {
border-radius: 24px;
}

.r-max {
border-radius: 750px;
}

.rt-1 {
border-radius: 8px 8px 0 0;
}

.rt-2 {
border-radius: 16px 16px 0 0;
}

.rt-3 {
border-radius: 24px 24px 0 0;
}

.rb-1 {
border-radius: 0 0 8px 8px;
}

.rb-2 {
border-radius: 0 0 16px 16px;
}

.rb-3 {
border-radius: 0 0 24px 24px;
}

// 间距
.gap-1 {
gap: 8px;
}

.gap-2 {
gap: 16px;
}

.gap-3 {
gap: 24px;
}

.gap-4 {
gap: 32px;
}

// 背景
.bg-white {
background-color: white;
}

.bg-primary {
background-color: $duxappPrimaryColor;
}

.bg-secondary {
background-color: $duxappSecondaryColor;
}

.bg-success {
background-color: $duxappSuccessColor;
}

.bg-danger {
background-color: $duxappDangerColor;
}

.bg-warning {
background-color: $duxappWarningColor;
}

.bg-page {
background-color: $duxappPageColor;
}

// 其他
.square {
aspect-ratio: 1;
}