Closed pavelda2 closed 4 years ago
This is the consequence of a known and documented shortcoming of the scoped style approach when nesting components and styles of both components get applied to the root element.
https://vue-loader.vuejs.org/guide/scoped-css.html#child-component-root-elements
So
I'll therefore close the issue for this repository as we can't solve the issue here.
The recommendation would be to namespace classes that you apply to root elements.
This has always been a problem
Version
4.2.3
Reproduction link
https://github.com/pavelda2/vue-scoped-styles-issue
Environment info
Steps to reproduce
What is expected?
Show red background of the box
What is actually happening?
Show gray background of the box
Whole problem is in the packaging scoped CSS of BaseBox twice when build the application. Once for the BaseBoxPage and second time for the RedBoxPage.
When the RedBoxPage is loaded for the first time, styles are applied correctly (class .red-box over .base-box) . But when second route is opened BaseBox styles are downloaded for second time and gets priority over RedBox styles when switch back to the RedBoxPage (class .base-box over .red-box)