I need to modify some CSS properties of a Vue component, from its parent. It would override the CSS defined within the component.
I first expected that for a component <my-component>
, I could directly style it from the parent, like any other element:
my-component {
font-weight: bolder;
}
This does not work.
The second solution I tried is to pass a prop to the component, with the relevant information to be used in the styling. This works but I am still hoping for a solution closer to an inheritance mechanism (where the settings of the parent would have priority on the ones of the child, similarly to, say, styling a <b>
element).
Is there such a mechanism?