You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,17 @@
46
46
yarn add styled-vue --dev
47
47
```
48
48
49
+
Then register the Vue plugin (**optional**):
50
+
51
+
```js
52
+
importVuefrom'vue'
53
+
import { StyledVue } from'styled-vue'
54
+
55
+
Vue.use(StyledVue)
56
+
```
57
+
58
+
So far the plugin is only required for [globalStyle](#globalstyle), if you only need scoped style, you can safely skip this.
59
+
49
60
## Example
50
61
51
62
```vue
@@ -204,14 +215,23 @@ import { css } from 'styled-vue'
204
215
205
216
exportdefault {
206
217
globalStyle: css`
207
-
#app {
218
+
body {
208
219
color: ${vm=>vm.bodyColor};
209
220
}
210
221
`
211
222
}
212
223
```
213
224
214
-
Note CSS variables (dynamic value) can only apply to current component and child components, so if you are trying to use them on parent selector like `body`, they **WON'T** work! Currently there's no easy way to fix this.
225
+
`globalStyle` relies on the Vue plugin, make sure the register it first:
0 commit comments