@zfqh/uniapp 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/docs/components/styles/base-styles.md +239 -367
- package/docs/guide/project-frame.md +26 -2
- package/docs/index.md +1 -1
- package/lib/components/g-back-button/g-back-button.vue +2 -2
- package/lib/components/g-checkbox-list/g-checkbox-list.vue +1 -1
- package/lib/components/g-float/g-float.vue +1 -1
- package/lib/components/g-grid-image/g-grid-image.vue +1 -1
- package/lib/components/g-grid-swiper/g-grid-swiper.vue +1 -1
- package/lib/components/g-more/g-more.vue +2 -2
- package/lib/components/g-page-container/g-page-container.vue +1 -1
- package/lib/components/g-popup/g-popup.vue +3 -3
- package/lib/components/g-refresh-view/g-refresh-view.vue +1 -1
- package/lib/components/g-search/g-search.vue +4 -4
- package/lib/components/g-share-photo/g-share-photo.vue +1 -1
- package/lib/components/g-share-view/g-share-view.vue +2 -2
- package/lib/components/g-share-weixin/g-share-weixin.vue +1 -1
- package/lib/components/g-tag-editor/g-tag-editor.vue +2 -2
- package/lib/components/g-trtc-room/g-trtc-room.vue +1 -1
- package/lib/styles/bg.scss +1 -22
- package/lib/styles/border.scss +1 -158
- package/lib/styles/{flex-vue.scss → flex.scss} +15 -12
- package/lib/styles/index.scss +5 -17
- package/lib/styles/layout.scss +17 -75
- package/lib/styles/reset-vue.scss +3 -1
- package/lib/styles/text-nvue.scss +1 -10
- package/lib/styles/text-vue.scss +0 -55
- package/lib/styles/text.scss +1 -43
- package/lib/styles/var.module.scss +1 -0
- package/package.json +2 -2
- package/lib/styles/animate-vue.scss +0 -3
- package/lib/styles/animate.scss +0 -27
- package/lib/styles/bg-vue.scss +0 -21
- package/lib/styles/flex-nvue.scss +0 -64
- package/lib/styles/font.scss +0 -59
- package/lib/styles/layout-nvue.scss +0 -24
- package/lib/styles/layout-vue.scss +0 -30
- package/lib/styles/opacity.scss +0 -10
- package/lib/styles/shadow.scss +0 -12
- package/lib/styles/sizing-vue.scss +0 -21
- package/lib/styles/sizing.scss +0 -21
- package/lib/styles/spacing.scss +0 -234
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.2](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.1.1...@zfqh/uniapp@0.1.2) (2026-06-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## 0.1.1 (2026-05-31)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @zfqh/uniapp
|
|
@@ -1,367 +1,239 @@
|
|
|
1
|
-
# 工具样式类
|
|
2
|
-
|
|
3
|
-
`@zfqh/uniapp`
|
|
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
|
-
| `.flex
|
|
43
|
-
| `.flex-
|
|
44
|
-
| `.flex-
|
|
45
|
-
| `.
|
|
46
|
-
| `.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
| 类名 | 效果 |
|
|
241
|
-
| --- | --- |
|
|
242
|
-
| `.overflow-hidden` | overflow: hidden |
|
|
243
|
-
| `.inset-0` | top/right/bottom/left 全为 0 |
|
|
244
|
-
| `.inset-x-0` / `.inset-y-0` | 双轴归零 |
|
|
245
|
-
| `.top-{0~100}px/rpx` | top 定位,步长 2 |
|
|
246
|
-
| `.right-{0~100}px/rpx` | right 定位 |
|
|
247
|
-
| `.bottom-{0~100}px/rpx` | bottom 定位 |
|
|
248
|
-
| `.left-{0~100}px/rpx` | left 定位 |
|
|
249
|
-
| `.-top-{2~100}px/rpx` 等 | 负值定位 |
|
|
250
|
-
| `.z-0` ~ `.z-10` | z-index |
|
|
251
|
-
|
|
252
|
-
### 仅非 nvue
|
|
253
|
-
|
|
254
|
-
| 类名 | 效果 |
|
|
255
|
-
| --- | --- |
|
|
256
|
-
| `.relative` | position: relative |
|
|
257
|
-
| `.absolute` | position: absolute |
|
|
258
|
-
| `.fixed` | position: fixed |
|
|
259
|
-
| `.sticky` | position: sticky |
|
|
260
|
-
| `.sticky-top` | sticky + `top: var(--window-top)` + z-index 9 |
|
|
261
|
-
| `.sticky-bottom` | sticky + `bottom: var(--window-bottom)` + z-index 9 |
|
|
262
|
-
| `.overflow-auto` / `.overflow-scroll` | overflow |
|
|
263
|
-
|
|
264
|
-
## 透明度
|
|
265
|
-
|
|
266
|
-
| 类名 | 值 |
|
|
267
|
-
| --- | --- |
|
|
268
|
-
| `.opacity-0` | 0 |
|
|
269
|
-
| `.opacity-10` ~ `.opacity-100` | 0.1 ~ 1.0,步长 10 |
|
|
270
|
-
|
|
271
|
-
## 阴影
|
|
272
|
-
|
|
273
|
-
| 类名 | box-shadow |
|
|
274
|
-
| --- | --- |
|
|
275
|
-
| `.shadow-sm` | `0 1px 2px 0 rgba(0, 0, 0, 0.05)` |
|
|
276
|
-
| `.shadow` | `0 1px 3px 0 rgba(0, 0, 0, 0.1)` |
|
|
277
|
-
| `.shadow-md` | `0 4px 6px -1px rgba(0, 0, 0, 0.1)` |
|
|
278
|
-
| `.shadow-lg` | `0 10px 15px -3px rgba(0, 0, 0, 0.1)` |
|
|
279
|
-
|
|
280
|
-
## 动画与变换
|
|
281
|
-
|
|
282
|
-
### 变换原点
|
|
283
|
-
|
|
284
|
-
`.origin-{position}`:`center`、`top`、`top-right`、`right`、`bottom-right`、`bottom`、`bottom-left`、`left`、`top-left`
|
|
285
|
-
|
|
286
|
-
### 过渡(仅非 nvue)
|
|
287
|
-
|
|
288
|
-
| 类名 | 效果 |
|
|
289
|
-
| --- | --- |
|
|
290
|
-
| `.transition-all-300` | `transition: all 300ms` |
|
|
291
|
-
|
|
292
|
-
## 常用组合示例
|
|
293
|
-
|
|
294
|
-
卡片布局:
|
|
295
|
-
|
|
296
|
-
```html
|
|
297
|
-
<view class="flex flex-col p-16px bg-white rounded-8px shadow-sm">
|
|
298
|
-
<text class="text-32px font-semibold text-main">标题</text>
|
|
299
|
-
<text class="text-24px text-content mt-8px">描述内容</text>
|
|
300
|
-
</view>
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
居加载中状态:
|
|
304
|
-
|
|
305
|
-
```html
|
|
306
|
-
<view class="flex justify-center items-center h-200px">
|
|
307
|
-
<text class="text-28px text-tips">加载中...</text>
|
|
308
|
-
</view>
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
列表项(头像 + 文字):
|
|
312
|
-
|
|
313
|
-
```html
|
|
314
|
-
<view class="flex items-center px-16px py-12px">
|
|
315
|
-
<image class="w-80rpx h-80rpx rounded-full" :src="avatar" />
|
|
316
|
-
<view class="flex-1 ml-12px">
|
|
317
|
-
<text class="text-28px text-main truncate">用户名</text>
|
|
318
|
-
<text class="text-24px text-tips">副标题</text>
|
|
319
|
-
</view>
|
|
320
|
-
</view>
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
吸顶导航栏:
|
|
324
|
-
|
|
325
|
-
```html
|
|
326
|
-
<view class="sticky-top bg-white px-16px py-12px">
|
|
327
|
-
<text class="text-32px font-bold text-main">页面标题</text>
|
|
328
|
-
</view>
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
表单区域:
|
|
332
|
-
|
|
333
|
-
```html
|
|
334
|
-
<view class="flex flex-col px-16px py-12px bg-white mt-8px">
|
|
335
|
-
<view class="flex justify-between items-center py-12px border-b">
|
|
336
|
-
<text class="text-28px text-main">标签</text>
|
|
337
|
-
<text class="text-28px text-content">值</text>
|
|
338
|
-
</view>
|
|
339
|
-
</view>
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
两列等分布局:
|
|
343
|
-
|
|
344
|
-
```html
|
|
345
|
-
<view class="flex flex-wrap">
|
|
346
|
-
<view class="w-full flex" v-for="group in groups" :key="group.id">
|
|
347
|
-
<view class="flex-1 p-8px" v-for="item in group.items" :key="item.id">
|
|
348
|
-
<view class="bg-white rounded-8px p-16px">{{ item.name }}</view>
|
|
349
|
-
</view>
|
|
350
|
-
</view>
|
|
351
|
-
</view>
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
底部固定操作栏:
|
|
355
|
-
|
|
356
|
-
```html
|
|
357
|
-
<view class="fixed bottom-0 left-0 right-0 bg-white px-16px py-12px z-5">
|
|
358
|
-
<view class="flex">
|
|
359
|
-
<view class="flex-1 mr-8px bg-error rounded-8px py-12px text-center">
|
|
360
|
-
<text class="text-white text-28px font-medium">取消</text>
|
|
361
|
-
</view>
|
|
362
|
-
<view class="flex-1 bg-primary rounded-8px py-12px text-center">
|
|
363
|
-
<text class="text-white text-28px font-medium">确认</text>
|
|
364
|
-
</view>
|
|
365
|
-
</view>
|
|
366
|
-
</view>
|
|
367
|
-
```
|
|
1
|
+
# 工具样式类
|
|
2
|
+
|
|
3
|
+
`@zfqh/uniapp` 内置一组静态 SCSS 工具类,仅覆盖 **平台差异类** 和 **使用 `$uv-*` SCSS 变量的语义色类**。间距、尺寸、字号、圆角、透明度、阴影等通用原子类需要配合 `@gmcb/vite` 提供的 unocss 插件在构建时动态生成,两者命名风格与 UnoCSS / Tailwind CSS 一致。
|
|
4
|
+
|
|
5
|
+
## 前置依赖
|
|
6
|
+
|
|
7
|
+
使用完整原子类能力前,需要在项目的 `vite.config.js` 中注册 unocss 插件,并传入 `blockList` 避免与内置静态类冲突:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { defineConfig } from '@gmcb/vite';
|
|
11
|
+
import { unocss } from '@gmcb/vite/lib/plugins';
|
|
12
|
+
import { blockList } from '@gmcb/vite/lib/unocss';
|
|
13
|
+
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
plugins: [
|
|
16
|
+
uni(),
|
|
17
|
+
unocss({
|
|
18
|
+
blockList,
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`blockList` 已预置全部内置静态类名,unocss 插件不会为这些类名生成重复 CSS。
|
|
25
|
+
|
|
26
|
+
## 引入方式
|
|
27
|
+
|
|
28
|
+
在项目全局样式中导入一次即可。放在 `App.vue` 的 `<style>` 块:
|
|
29
|
+
|
|
30
|
+
```scss
|
|
31
|
+
@import '@zfqh/uniapp/lib/styles/index.scss';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
此入口同时导入 `@gmcb/uv-ui/index.scss`,无需再单独导入 uv-ui 基础样式。
|
|
35
|
+
|
|
36
|
+
## 内置原子类
|
|
37
|
+
|
|
38
|
+
### Flex 布局
|
|
39
|
+
|
|
40
|
+
| 类名 | 效果 |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `.flex` | flex 行布局 |
|
|
43
|
+
| `.flex-inline` | inline-flex 行布局 |
|
|
44
|
+
| `.flex-row` / `.flex-row-reverse` | 行方向 |
|
|
45
|
+
| `.flex-col` / `.flex-col-reverse` | 列方向 |
|
|
46
|
+
| `.flex-wrap` / `.flex-nowrap` / `.flex-wrap-reverse` | 换行控制 |
|
|
47
|
+
| `.flex-0` ~ `.flex-8` | `flex: 0` ~ `flex: 8` |
|
|
48
|
+
| `.flex-none` | `flex: 0` |
|
|
49
|
+
| `.items-start` / `.items-end` / `.items-center` / `.items-stretch` / `.items-baseline` | align-items |
|
|
50
|
+
| `.justify-start` / `.justify-end` / `.justify-center` / `.justify-between` / `.justify-around` | justify-content |
|
|
51
|
+
|
|
52
|
+
::: info 平台差异
|
|
53
|
+
- H5 平台下这些类包裹在 `page` 选择器内。
|
|
54
|
+
- `.flex` / `.flex-inline` 的 `display: flex` / `display: inline-flex` 仅在非 APP-NVUE 平台生效,nvue 端省略 display 属性(Weex 默认 flex 布局)。
|
|
55
|
+
:::
|
|
56
|
+
|
|
57
|
+
### 背景色
|
|
58
|
+
|
|
59
|
+
`.bg-{color}` 系列,颜色值读取 `$uv-*` SCSS 变量,跟随主题配置:
|
|
60
|
+
|
|
61
|
+
| 色组 | 可用类名 |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| primary | `.bg-primary`、`.bg-primary-dark`、`.bg-primary-light`、`.bg-primary-disabled` |
|
|
64
|
+
| warning | `.bg-warning`、`.bg-warning-dark`、`.bg-warning-light`、`.bg-warning-disabled` |
|
|
65
|
+
| success | `.bg-success`、`.bg-success-dark`、`.bg-success-light`、`.bg-success-disabled` |
|
|
66
|
+
| error | `.bg-error`、`.bg-error-dark`、`.bg-error-light`、`.bg-error-disabled` |
|
|
67
|
+
| info | `.bg-info`、`.bg-info-dark`、`.bg-info-light`、`.bg-info-disabled` |
|
|
68
|
+
|
|
69
|
+
基础背景:
|
|
70
|
+
|
|
71
|
+
| 类名 | SCSS 变量 | 说明 |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| `.bg` | `$uv-bg-color` | 页面背景色 |
|
|
74
|
+
| `.bg-light` | `$uv-bg-light-color` | 浅色背景 |
|
|
75
|
+
| `.bg-disabled` | `$uv-disabled-color` | 禁用态背景 |
|
|
76
|
+
| `.bg-border` | `$uv-border-color` | 边框色背景 |
|
|
77
|
+
|
|
78
|
+
### 文字颜色
|
|
79
|
+
|
|
80
|
+
`.text-{color}` 系列,颜色值读取 `$uv-*` SCSS 变量:
|
|
81
|
+
|
|
82
|
+
| 色组 | 可用类名 |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| primary | `.text-primary`、`.text-primary-dark`、`.text-primary-light`、`.text-primary-disabled` |
|
|
85
|
+
| warning | `.text-warning`、`.text-warning-dark`、`.text-warning-light`、`.text-warning-disabled` |
|
|
86
|
+
| success | `.text-success`、`.text-success-dark`、`.text-success-light`、`.text-success-disabled` |
|
|
87
|
+
| error | `.text-error`、`.text-error-dark`、`.text-error-light`、`.text-error-disabled` |
|
|
88
|
+
| info | `.text-info`、`.text-info-dark`、`.text-info-light`、`.text-info-disabled` |
|
|
89
|
+
|
|
90
|
+
UI 语义色:
|
|
91
|
+
|
|
92
|
+
| 类名 | SCSS 变量 | 说明 |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `.text-main` | `$uv-main-color` | 主要文字 |
|
|
95
|
+
| `.text-content` | `$uv-content-color` | 正文文字 |
|
|
96
|
+
| `.text-tips` | `$uv-tips-color` | 辅助提示 |
|
|
97
|
+
| `.text-light` | `$uv-light-color` | 占位/水印 |
|
|
98
|
+
| `.text-border` | `$uv-border-color` | 边框色文字 |
|
|
99
|
+
| `.text-disabled` | `$uv-disabled-color` | 禁用态文字 |
|
|
100
|
+
|
|
101
|
+
### 边框
|
|
102
|
+
|
|
103
|
+
| 类名 | 效果 |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `.border` | 1px solid 边框色(`$uv-border-color`) |
|
|
106
|
+
| `.border-half` | 0.5px solid 边框色 |
|
|
107
|
+
| `.border-t` / `.border-r` / `.border-b` / `.border-l` | 单边 1px solid 边框色 |
|
|
108
|
+
| `.border-x` / `.border-y` | 双轴 1px solid 边框色 |
|
|
109
|
+
|
|
110
|
+
语义色边框:
|
|
111
|
+
|
|
112
|
+
| 类名 | SCSS 变量 |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `.border-primary` | `$uv-primary` |
|
|
115
|
+
| `.border-warning` | `$uv-warning` |
|
|
116
|
+
| `.border-success` | `$uv-success` |
|
|
117
|
+
| `.border-error` | `$uv-error` |
|
|
118
|
+
| `.border-info` | `$uv-info` |
|
|
119
|
+
|
|
120
|
+
### 定位
|
|
121
|
+
|
|
122
|
+
| 类名 | 效果 |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `.relative` | position: relative |
|
|
125
|
+
| `.absolute` | position: absolute |
|
|
126
|
+
| `.fixed` | position: fixed |
|
|
127
|
+
| `.sticky` | position: sticky |
|
|
128
|
+
|
|
129
|
+
::: info 平台差异
|
|
130
|
+
H5 平台下这些类包裹在 `page` 选择器内,其他平台直接使用。
|
|
131
|
+
:::
|
|
132
|
+
|
|
133
|
+
### 文本截断
|
|
134
|
+
|
|
135
|
+
**非 nvue 平台**(`text-vue.scss`):
|
|
136
|
+
|
|
137
|
+
| 类名 | 效果 |
|
|
138
|
+
| --- | --- |
|
|
139
|
+
| `.truncate` | 单行截断(overflow ellipsis + nowrap) |
|
|
140
|
+
| `.line-clamp-1` ~ `.line-clamp-5` | 多行截断(`-webkit-line-clamp`) |
|
|
141
|
+
|
|
142
|
+
**nvue 平台**(`text-nvue.scss`):
|
|
143
|
+
|
|
144
|
+
| 类名 | 效果 |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `.truncate` | 单行截断(Weex `lines: 1`) |
|
|
147
|
+
| `.line-clamp-1` ~ `.line-clamp-5` | 多行截断(Weex `lines: n`) |
|
|
148
|
+
|
|
149
|
+
### 全局重置
|
|
150
|
+
|
|
151
|
+
`reset-vue.scss` 在非 nvue 平台自动生效,不属于原子类,作用:
|
|
152
|
+
|
|
153
|
+
- 设置 `:root` 下的 `--window-bottom`、`--window-top`(非 H5)、`--window-height`、`--window-width` CSS 自定义属性。
|
|
154
|
+
- `page` 元素宽高 100%、`font-family: Microsoft YaHei`、颜色取 `$uv-main-color`、flex 列布局。
|
|
155
|
+
- `view`、`text`、`image` 设置 `box-sizing: border-box`。
|
|
156
|
+
- 修复 `.uni-scroll-view-refresher` 背景透明。
|
|
157
|
+
- 调整 `.ql-editor.ql-blank:before` 占位文字样式。
|
|
158
|
+
- 调整 `.uv-toast` 默认样式。
|
|
159
|
+
|
|
160
|
+
除上述内置类外,其余原子类(间距、尺寸、字号、字重、行高、对齐、基础背景色、边框宽度/样式、圆角、overflow、top/right/bottom/left/inset/z-index、透明度、阴影、transform-origin、transition 等)均由 `@gmcb/vite` 的 unocss 插件在构建时根据模板扫描动态生成,命名风格与 UnoCSS / Tailwind CSS 一致,支持 `px` 和 `rpx` 两种单位。
|
|
161
|
+
|
|
162
|
+
`blockList` 已预置全部内置静态类名,unocss 插件不会为这些类名生成重复 CSS。
|
|
163
|
+
|
|
164
|
+
## 常用组合示例
|
|
165
|
+
|
|
166
|
+
卡片布局:
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<view class="flex flex-col p-16px bg-white rounded-8px shadow-sm">
|
|
170
|
+
<text class="text-32px font-semibold text-main">标题</text>
|
|
171
|
+
<text class="text-24px text-tips mt-8px">描述内容</text>
|
|
172
|
+
</view>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
居加载中状态:
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<view class="flex justify-center items-center h-200px">
|
|
179
|
+
<text class="text-28px text-tips">加载中...</text>
|
|
180
|
+
</view>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
列表项(头像 + 文字):
|
|
184
|
+
|
|
185
|
+
```html
|
|
186
|
+
<view class="flex items-center px-16px py-12px">
|
|
187
|
+
<image class="w-80rpx h-80rpx rounded-full" :src="avatar" />
|
|
188
|
+
<view class="flex-1 ml-12px">
|
|
189
|
+
<text class="text-28px text-main truncate">用户名</text>
|
|
190
|
+
<text class="text-24px text-tips">副标题</text>
|
|
191
|
+
</view>
|
|
192
|
+
</view>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
吸顶导航栏:
|
|
196
|
+
|
|
197
|
+
```html
|
|
198
|
+
<view class="sticky top-0 bg-light px-16px py-12px">
|
|
199
|
+
<text class="text-32px font-bold text-main">页面标题</text>
|
|
200
|
+
</view>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
表单区域:
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<view class="flex flex-col px-16px py-12px bg-white mt-8px">
|
|
207
|
+
<view class="flex justify-between items-center py-12px border-b">
|
|
208
|
+
<text class="text-28px text-main">标签</text>
|
|
209
|
+
<text class="text-28px text-content">值</text>
|
|
210
|
+
</view>
|
|
211
|
+
</view>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
两列等分布局:
|
|
215
|
+
|
|
216
|
+
```html
|
|
217
|
+
<view class="flex flex-wrap">
|
|
218
|
+
<view class="w-full flex" v-for="group in groups" :key="group.id">
|
|
219
|
+
<view class="flex-1 p-8px" v-for="item in group.items" :key="item.id">
|
|
220
|
+
<view class="bg-white rounded-8px p-16px">{{ item.name }}</view>
|
|
221
|
+
</view>
|
|
222
|
+
</view>
|
|
223
|
+
</view>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
底部固定操作栏:
|
|
227
|
+
|
|
228
|
+
```html
|
|
229
|
+
<view class="fixed bottom-0 left-0 right-0 bg-white px-16px py-12px z-5">
|
|
230
|
+
<view class="flex">
|
|
231
|
+
<view class="flex-1 mr-8px bg-error rounded-8px py-12px text-center">
|
|
232
|
+
<text class="text-white text-28px font-medium">取消</text>
|
|
233
|
+
</view>
|
|
234
|
+
<view class="flex-1 bg-primary rounded-8px py-12px text-center">
|
|
235
|
+
<text class="text-white text-28px font-medium">确认</text>
|
|
236
|
+
</view>
|
|
237
|
+
</view>
|
|
238
|
+
</view>
|
|
239
|
+
```
|