I have two components in views folder namely Home.vue and Register.vue I have imported separate css files for each component
Home.vue
<style scoped>
@import "../assets/css/bootstrap.min.css";
@import "../assets/css/mainpages/style.css";
@import "../assets/css/mainpages/custom.css";
@import "../assets/css/mainpages/css/plugins.min.css";
</style>
Register.vue
<style scoped>
@import "../assets/css/main.css";
@import "../assets/css/bootstrap.min.css";
@import "../assets/css/theme.css";
</style>
I am using vue router to route. When routing from Home.vue to Register.vue everything is good. But when i try to route back from Register.vue to Home.vue the css properties imported in Registered.vue gets applied to Home.vue
What may be the reason for such a behavior.
I have added scope to all style tags, but it is also not working.
App.vue
or evenmain.js
- and define your scoped CSS directly into your Single-File component rather than separate CSS file. – IVO GELOV