Skip to content

Commit 685a497

Browse files
committed
docs(api): [helper] add desc for cssClass
1 parent fa57d0c commit 685a497

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

docs/guide/api/helper.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,36 @@ A function to generate CSS from a template literal with interpolations.
105105
</template>
106106
```
107107

108+
## `cssClass`
109+
110+
A function generating css and return a class name.
111+
112+
**Augments**
113+
114+
- CSS,`TemplateStringsArray``必需`
115+
116+
**Return**
117+
118+
- Class name,`string`
119+
120+
**Usage**
121+
122+
```vue
123+
<script setup lang="ts">
124+
import { cssClass } from '@vvibe/vue-styled-components'
125+
126+
const commonClass = cssClass`
127+
padding: 20px;
128+
color: #fff;
129+
background-color: red;
130+
`
131+
</script>
132+
133+
<template>
134+
<div :class="commonClass">Test</div>
135+
</template>
136+
```
137+
108138
## `withAttrs`
109139

110140
A function to add attributes to a `ComponentInstance` or `HTMLElements`.

docs/zh/guide/api/helper.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,39 @@ outline: deep
105105
</template>
106106
```
107107

108+
109+
110+
## `cssClass`
111+
112+
一个使用模板字符串生成 CSS 并返回 class 类名的函数。
113+
114+
**参数**
115+
116+
- 模板字符串,`TemplateStringsArray``必需`
117+
118+
**返回值**
119+
120+
- class 名称,`string`
121+
122+
**用法**
123+
124+
```vue
125+
126+
<script setup lang="ts">
127+
import { cssClass } from '@vvibe/vue-styled-components'
128+
129+
const commonClass = cssClass`
130+
padding: 20px;
131+
color: #fff;
132+
background-color: red;
133+
`
134+
</script>
135+
136+
<template>
137+
<div :class="commonClass">Test</div>
138+
</template>
139+
```
140+
108141
## `withAttrs`
109142

110143
一个用于向 `ComponentInstance``HTMLElements` 添加 `attributes` 的函数。

0 commit comments

Comments
 (0)