Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored Sep 23, 2024
1 parent 610eef6 commit 28a6c7f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,19 @@ Extracts the styles from the cache and returns them as a string.
#### Example

```typescript
import extractStyle from '@ant-design/cssinjs';
import { extractStyle, createCache } from '@ant-design/cssinjs';

const cache = /* your cache instance */;
// 创建并填充缓存
const cache = createCache();
// 注意:在实际使用中,缓存通常会在渲染组件时自动填充

// 提取样式
const styles = extractStyle(cache, { plain: true, types: ['style', 'token'] });
console.log(styles);

// 使用提取的样式
const styleElement = document.createElement('style');
styleElement.innerHTML = styles;
document.head.appendChild(styleElement);
```

## Transform
Expand Down

0 comments on commit 28a6c7f

Please sign in to comment.