blob: 29eb7f4f5fb1eba6229db7a8f39502e88808b166 [file] [log] [blame]
guangchao.xu070005a2020-12-07 09:56:40 +08001.u-relative,
2.u-rela {
3 position: relative;
4}
5
6.u-absolute,
7.u-abso {
8 position: absolute;
9}
10
11// nvue不能用标签命名样式,不能放在微信组件中,否则微信开发工具会报警告,无法使用标签名当做选择器
12/* #ifndef APP-NVUE */
13image {
14 display: inline-block;
15}
16
17// 在weex,也即nvue中,所有元素默认为border-box
18view,
19text {
20 box-sizing: border-box;
21}
22/* #endif */
23
24.u-font-xs {
25 font-size: 22rpx;
26}
27
28.u-font-sm {
29 font-size: 26rpx;
30}
31
32.u-font-md {
33 font-size: 28rpx;
34}
35
36.u-font-lg {
37 font-size: 30rpx;
38}
39
40.u-font-xl {
41 font-size: 34rpx;
42}
43
44.u-flex {
45 /* #ifndef APP-NVUE */
46 display: flex;
47 /* #endif */
48 flex-direction: row;
49 align-items: center;
50}
51
52.u-flex-wrap {
53 flex-wrap: wrap;
54}
55
56.u-flex-nowrap {
57 flex-wrap: nowrap;
58}
59
60.u-col-center {
61 align-items: center;
62}
63
64.u-col-top {
65 align-items: flex-start;
66}
67
68.u-col-bottom {
69 align-items: flex-end;
70}
71
72.u-row-center {
73 justify-content: center;
74}
75
76.u-row-left {
77 justify-content: flex-start;
78}
79
80.u-row-right {
81 justify-content: flex-end;
82}
83
84.u-row-between {
85 justify-content: space-between;
86}
87
88.u-row-around {
89 justify-content: space-around;
90}
91
92.u-text-left {
93 text-align: left;
94}
95
96.u-text-center {
97 text-align: center;
98}
99
100.u-text-right {
101 text-align: right;
102}
103
104.u-flex-col {
105 /* #ifndef APP-NVUE */
106 display: flex;
107 /* #endif */
108 flex-direction: column;
109}
110
111// 定义flex等分
112@for $i from 0 through 12 {
113 .u-flex-#{$i} {
114 flex: $i;
115 }
116}
117
118// 定义字体(px)单位,小于20都为px单位字体
119@for $i from 9 to 20 {
120 .u-font-#{$i} {
121 font-size: $i + px;
122 }
123}
124
125// 定义字体(rpx)单位,大于或等于20的都为rpx单位字体
126@for $i from 20 through 40 {
127 .u-font-#{$i} {
128 font-size: $i + rpx;
129 }
130}
131
132// 定义内外边距,历遍1-80
133@for $i from 0 through 80 {
134 // 只要双数和能被5除尽的数
135 @if $i % 2 == 0 or $i % 5 == 0 {
136 // 得出:u-margin-30或者u-m-30
137 .u-margin-#{$i}, .u-m-#{$i} {
138 margin: $i + rpx!important;
139 }
140
141 // 得出:u-padding-30或者u-p-30
142 .u-padding-#{$i}, .u-p-#{$i} {
143 padding: $i + rpx!important;
144 }
145
146 @each $short, $long in l left, t top, r right, b bottom {
147 // 缩写版,结果如: u-m-l-30
148 // 定义外边距
149 .u-m-#{$short}-#{$i} {
150 margin-#{$long}: $i + rpx!important;
151 }
152
153 // 定义内边距
154 .u-p-#{$short}-#{$i} {
155 padding-#{$long}: $i + rpx!important;
156 }
157
158 // 完整版,结果如:u-margin-left-30
159 // 定义外边距
160 .u-margin-#{$long}-#{$i} {
161 margin-#{$long}: $i + rpx!important;
162 }
163
164 // 定义内边距
165 .u-padding-#{$long}-#{$i} {
166 padding-#{$long}: $i + rpx!important;
167 }
168 }
169 }
170}
171
172// 重置nvue的默认关于flex的样式
173.u-reset-nvue {
174 flex-direction: row;
175 align-items: center;
176}