Files
CopilotandLiu 437d93d34e docs: add native doc-viewer and widget documentation (#324)
- Add examples/doc-viewer, an LCUI-based documentation viewer with an
  MDX compiler pipeline that converts source MDX files into C/TSX
  page components rendered by lcui build.
- Add zh-CN and en documentation for 5 widgets (anchor, button,
  scrollarea, text, text-input), each with C/TSX/XML example variants
  and widget-fields data.
- Add handbook and overview documentation.

Co-authored-by: Liu <lc-soft@live.cn>
2026-08-05 22:42:19 +08:00

30 lines
662 B
Plaintext

# CSS Modules
CSS Modules 为 TSX 组件创建局部作用域的 CSS 类,避免命名冲突并提高可维护性。
## 用法
创建 `.module.css` 后缀的文件:
```css title="MyComponent.module.css"
.card {
border: 1px solid #eee;
border-radius: 4px;
}
```
在 `.tsx` 文件中导入:
```tsx title="MyComponent.tsx"
import styles from "./MyComponent.module.css";
```
在 JSX 中用 `styles` 对象替代字符串类名:
```diff
- <Widget className="card" />
+ <Widget className={styles.card} />
```
`@lcui/cli` 编译时会将 `.module.css` 转换为 C 标识符绑定,类名会自动生成唯一的 C 常量名,避免全局冲突。