How to pass styles to child component and use it as scoped style in Vue?

后端 未结 2 683
谎友^
谎友^ 2021-01-17 13:32

I have a parent component:





        
2条回答
  •  执笔经年
    2021-01-17 13:56

    If you want to target the child elements with scoped styling you have to use the deep selector.

    Which can be done with

    a >>> b { color : red; }
    /deep/ a b { color : red; }
    a::v-deep b { color : red; }
    

    Here is the full explanation: https://vue-loader.vuejs.org/guide/scoped-css.html#child-component-root-elements

提交回复
热议问题