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: src/api/global-api.md
+44
Original file line number
Diff line number
Diff line change
@@ -474,3 +474,47 @@ export default {
474
474
}
475
475
}
476
476
```
477
+
478
+
## useCssModule
479
+
480
+
:::warning
481
+
`useCssModule` can only be used within `render` or `setup` functions.
482
+
:::
483
+
484
+
Allows CSS modules to be accessed within the [`setup`](/api/composition-api.html#setup) function of a [single-file component](/guide/single-file-component.html):
485
+
486
+
```vue
487
+
<script>
488
+
import { h, useCssModule } from 'vue'
489
+
490
+
export default {
491
+
setup () {
492
+
const style = useCssModule()
493
+
494
+
return () => h('div', {
495
+
class: style.success
496
+
}, 'Task complete!')
497
+
}
498
+
}
499
+
</script>
500
+
501
+
<style module>
502
+
.success {
503
+
color: #090;
504
+
}
505
+
</style>
506
+
```
507
+
508
+
For more information about using CSS modules, see [Vue Loader - CSS Modules](https://vue-loader.vuejs.org/guide/css-modules.html).
509
+
510
+
### Arguments
511
+
512
+
Accepts one argument: `name`
513
+
514
+
#### name
515
+
516
+
-**Type:**`String`
517
+
518
+
-**Details:**
519
+
520
+
The name of the CSS module. Defaults to `'$style'`.
0 commit comments