Looking to implement CSS Modules
, however, it appears that vue does not have a built-in method to pass generated class names to child components.
Consider the scenario with two components:
Table.vue
TableRow.vue
With styles like this:
.table {
table-layout: auto;
&.hover .row:hover .cell {
background-color: red;
}
}
The styles generated for .row:hover
no longer apply to TableRow
, and I have yet to find a smooth way of passing it down to the child. The only solution I found involves passing the $style
object as a prop to the child, which can get messy as the component tree grows larger since every component needs to include this prop and pass the $style
object to subsequent children...