Skip to content

Commit 1b6a563

Browse files
committed
update docs4
1 parent 7bfc22d commit 1b6a563

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

  • docs-vitepress/guide/basic

docs-vitepress/guide/basic/css.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Mpx 中的样式定义遵循 WXSS (WeiXin Style Sheets) 规范,WXSS 具有 CSS
5050
| ::after | view::after | 在 view 组件后边插入内容 |
5151
| ::before | view::before | 在 view 组件前边插入内容 |
5252

53-
### 全局样式与局部样式
53+
> **注意**
54+
> - 当需要跨端输出 React Native 时,仅支持类选择器(.class)。
5455
55-
定义在 `app.mpx` 中的样式为全局样式,作用于每一个页面。在 page 的 `mpx` 文件中定义的样式为局部样式,只作用在对应的页面,并会覆盖 `app.mpx` 中相同的选择器。
5656

5757
## CSS 预编译
5858

@@ -250,3 +250,32 @@ npm i -D cssnano-preset-advanced
250250
```
251251

252252
optimisation 配置可以点击[详情](https://www.cssnano.cn/docs/what-are-optimisations/)查看更多配置项。
253+
254+
## 原子类
255+
256+
Mpx 框架内置了基于 [unocss](https://unocss.dev/) 的原子类支持,让小程序开发也能使用原子类。用户可以在 Mpx 页面/组件模板中直接使用一些预定义的基础样式类,诸如 `flex``pt-4``text-center``rotate-90` 等,对样式进行组合定义。
257+
258+
### 简单示例
259+
260+
```html
261+
<view class="container">
262+
<view class="flex">
263+
<view class="py-8 px-8 inline-flex mx-auto bg-white rounded-xl shadow-md">
264+
<view class="text-center">
265+
<view class="text-base text-black font-semibold mb-2">
266+
Erin Lindford
267+
</view>
268+
<view class="text-gray-500 font-medium pb-3">
269+
Product Engineer
270+
</view>
271+
<view
272+
class="mt-2 px-4 py-1 text-sm text-purple-600 font-semibold rounded-full border border-solid border-purple-200">
273+
Message
274+
</view>
275+
</view>
276+
</view>
277+
</view>
278+
</view>
279+
```
280+
281+
更多详细用法请查看[使用原子类](../advance/utility-first-css.md)

0 commit comments

Comments
 (0)