File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ outline: deep
44
55# CSS Mixin
66
7+ ## Generate CSS Section
8+
79We offer a function named ` css ` to generate css section and the return value can be used in styled function.
810
911Such as:
@@ -30,7 +32,25 @@ Such as:
3032```
3133:::
3234
33- # Common CSS Class
35+ ## Embedded CSS with Conditional
36+
37+ ``` vue
38+ <script setup lang="ts">
39+ import { styled, css } from '@vvibe/vue-styled-components'
40+
41+ const testCss1 = css`
42+ background: white;
43+ `
44+ const testCss2 = css`
45+ background: blue;
46+ `
47+ const TestEmbedComponent = styled('div', { status: Boolean })`
48+ ${(props) => props.status ? testCss1 : testCss2}
49+ `
50+ </script>
51+ ```
52+
53+ ## Using Common CSS with Class
3454
3555You can also use ` cssClass ` to generate a common css class. The function will inject your css and return a class name
3656
Original file line number Diff line number Diff line change @@ -30,6 +30,24 @@ Such as:
3030```
3131:::
3232
33+ ## 有条件地嵌套 CSS
34+
35+ ``` vue
36+ <script setup lang="ts">
37+ import { styled, css } from '@vvibe/vue-styled-components'
38+
39+ const testCss1 = css`
40+ background: white;
41+ `
42+ const testCss2 = css`
43+ background: blue;
44+ `
45+ const TestEmbedComponent = styled('div', { status: Boolean })`
46+ ${(props) => props.status ? testCss1 : testCss2}
47+ `
48+ </script>
49+ ```
50+
3351# 公共 CSS 类
3452
3553你还可以使用 ` cssClass ` 来生成一个可公用的样式类,该函数会创建你传入的 CSS 并返回一个类名。
You can’t perform that action at this time.
0 commit comments